This is not like the place you want to block at all. You are already in the workflow, so you do not hold any state for your GUI or anything else, I would send a message and a guarantee - when your answer comes back, take another thread from the pool and send it is fun.
If you have data that is shared between them, put them in your own object in the collection associated with some common value, and add a new stream when it appears.
For readability / simplicity, the data object should also contain code that knows how to process this data, so all you have to do when you receive an incoming message is to get a key that uniquely identifies which object sent it , get this object by key and call this method "Data Received", passing the information you received from the package.
The good thing is that it is trivial for a simple listener to process a huge number of incoming packets by creating the Received Data method, which can implement many different handlers.
OO is cool, eh?
Bill k
source share