oahmad2 wrote on Friday, May 14, 2010:
I have two tasks A and B and I am looking for the best design mechanism using queues and/or semaphores to allow A to query B and then retrieve the data from B. Do you have a better method of doing this? The design I came up with is as follows:
I will first create a semaphore between A->B and a queue between B->A;
1. When A needs data, it will release the semaphore and then block on the queue from** B->A**.
2. B, that was blocking on the semaphore, will unblock, and then post the data on to the queue B->A.
3. A that was blocking on the queue will then unblock and then retrieve the data from the queue to allow further processing.
Is this the best way of doing it, or is there a better way?
Thanks!