Hi,
I have to design multithreaded module for a problem. And problem is, I have queue, there is a one thread which is putting messages in the message queue, and there are two thread say A and B, thread A process the even message (0,2,4..) and thread B processes the odd message(1,3,5..). I came up with two solution, first one is using two events(say X and Y) event X is for thread A and Y is for thread B. I check if the message is at even position, I set the event X for thread A, and Y for thread B otherwise. And the second solution is by having two seperate quest for each thread. A thread will put even position messages to queue of thread A and odd messages to the queue of thread B, with this solution thread A and B can work asynchronously. Am i right, or is there any other elegant solution?
Thanks.