Hi, I am using a application where lower level application always invokes a callback RecData(char *buf) when it receives the data. Now in the call back i am creating two threads and pass the consumer and producer function to these created threads respectively. My code looks like as below:
void RecData (char * buf) {
CreateThread(NULL,0,producer_queue,(void *)buf,0,NULL);
CreateThread(NULL,0,consumer_queue,NULL,0,NULL);
}
The above works fine when i receive only one data at a time. But if i receive say 5 data almost at the same time then producer_queue should first put all the data in queue and then consumer_queue should start retrieving the data but here as soon as producer_queue put 1st data in queue, consumer_queue retrieves it.
Please help me in implementing the above in correct way. I am new to the thread/queue implementation. Thanks