Re:Notes on structured concurrency, or: Go statement conside...
by twic on Thursday April 26, 2018 @08:33AM
(#16931232)
I think the whole point of the nursery's design is that you can create and destroy them during the life of your program, and that destroying them forms a barrier where the owner of the nursery waits for its children to finish. Having a nursery with a static lifetime in Rust would therefore be pointless, as it would live until the end of the program.
[ Parent
| on HN ]
Re:Notes on structured concurrency, or: Go statement conside...
by eridius on Thursday April 26, 2018 @11:50AM
(#16932960)
I think you misunderstand. I'm talking about writing something like `ScopedThreadpool<'static>`, which means any external data referenced by the threadpool must have a static lifetime (or rather, it means the ScopedThreadpool cannot reference anything on the stack, because that would prevent you from e.g. returning it to your caller or passing it to another thread). The ScopedThreadpool itself can be created and destroyed whenever.