in reply to Re^3: ithreads, locks, shared data: is that OK?
in thread ithreads, locks, shared data: is that OK?
got it thanks
well, I need to peek() because one of my queues is not a "work" queue: i.e. enqueue() any data for processing by the thread. Rather, it is a list of all data (=dictionary words) currently being processed by threads (call it CWq queue). And another one is a list of all the words that already have been processed and done with (call it REq). So, before a thread processes word W, it must peek() queue CWq and see if W is in there. In which case it will skip it. Also it will skip if the word is in the REq, so another peek() there.
Ideally CWq and REq should have been a hash but I find sharing a hash way too complicated than lock() and peek() a queue. A queue is definetely a weird hammer for that sort of nail. Any suggestions?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: ithreads, locks, shared data: is that OK?
by choroba (Cardinal) on Sep 20, 2018 at 12:29 UTC | |
by bliako (Abbot) on Sep 20, 2018 at 15:57 UTC | |
by choroba (Cardinal) on Sep 20, 2018 at 16:06 UTC | |
by bliako (Abbot) on Sep 20, 2018 at 16:52 UTC |