Could use some help from Rust Twitter on this one: I want to provide each thread with a Vec in a thread-local. Then from another thread I want to periodically take ownership of the thread-local vecs and swap them with empty ones. Is there a good pattern/lib for this?
-
-
First idea: each worker thread gets a pair of a channel sender and a receiver. As soon as an empty Vec arrives on the receiver, sends the full Vec through the sender. Collector receives full Vecs on its receiver and sends empty Vecs to threads when it's time to swap.
-
Woahh. This could work! Thank you!
- 5 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.