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?
-
-
Ah ok. I assume you can't use a channel instead of a Vec. Then you need to have some lock, either mutex or an atomic bool flag, because two threads can write to the same memory.
-
Though I would strongly consider having a crossbeam channel for each thread and sending every element to the collector, which can then use select.
- 2 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.