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?
-
-
hmmm, actually this runs into one tricky part tho: if for some reason no new messages are produced for a while then the channel can't be checked -- which means we never receive the new vec, and never push the filled vec. Hmm....
-
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.
- 3 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.