
--- In Boost-Users@yahoogroups.com, Albrecht Fritzsche <albrecht.fritzsche@t...> wrote:
olivier_debels wrote:
msg* pop() { // Get next message out of the queue // While no message found ^^^ // Check if no other thread is working on such a messagetype // If not -> return this message // else -> get next message }
To check if no other thread is working on such a messagetype, we take a look in the map(threadId, message type).
But still, what buys you the threadId? if you would change the check to
Check if noone is working on such a messagetype
and possibly use a set<message_type>, what is missing than?
Ali
I need to know when a message finishes too. So when doing a pop(), I first adjust the map (remove the type this thread was working on). If I just have a set<message_type> and a thread wants to pop another message, I don't know any more which one has finished before. In other words, when do I remove a type out of the set? Maybe I could do this in the destructor of message however, but this seems a bit ugly no?