|
There are lots of possible solutions, here are a couple:
- Keep a counter of remaining outgoing directions with each message in the queue and each outgoing thread will decrement it. Last thread removes it.
- Duplicate the message for each outgoing thread; one queue per thread.
Don't forget to synchronize in the proper places.
|