mayank gupta wrote:It sends a message, spawns another thread (say A) to read it, once the message is read it spawns another thread (say B) to process it. The processing might take long.
mayank gupta wrote: but still sometimes a part of B is executed before A returns.
mayank gupta wrote:I am sorry Henry. I wanted to say that thread A starts Thread B. I didnt specify that earlier. I want thread A to finish and return and then Thread B to start processing.
mayank gupta wrote:I care because I want the message that is read from the network to be returned to MessageHandler class. At the same time in thread B i want it to proceed doing something else with the message.
mayank gupta wrote:Now I want the reply message to first reach the MessageHandler class so that only after some processing is done on it, is the other action that thread B is performing, should be completed.
mayank gupta wrote:How can i capture the message received from the network and return it to MessageHandler?
mayank gupta wrote:I had been trying to solve the race condition to somehow solve this problem of passing the response back. I do realise I was using a complicated mechanism to solve it.
I want to know how to solve this problem of sending the response back.