Hacker News new | ask | show | jobs
by klabb3 1477 days ago
> I can't wait for scoped threads to finally go stable since being forced for throw an Arc around almost everything you want to share between threads does not really suit Rust which really emphasise zero-copy in their standard library.

Note that this is only for lexical scopes so each set of scoped threads you create must be destroyed in the same lexical scope.

In practice, this means that thread pooling (and in particular async runtimes) cannot use them.

In fact, we used to have the closure passed to thread and join handle had a lifetime param 'a (not 'static), but this was unsound in combination with Arc etc that didn't require those. If you're interested, it's related to the drop guarantees and safety of `mem::leak`. There was a big debacle right before 1.0 and, imo, the team rushed this decision and we're paying for it with Arcs - any async code base is riddled with it.