Message Queue getting blocked

hi,

I have developed an application in which one of the threads waits on a queue to read data. When i do pidin after running the app,it shows the thread in Reply state.However,after sometime the thread status changes to SEM and my thread doesnt wake up at all evebn if data is there on the queue. As a result,data gets depositing on queue and after sometime it becomes full. Would llike to know why does the thread go from Reply to sem state?Is it correct? Also,once it goes into sem state it never wakes up?
What could be the problem? Plz help.

Are you sure that the mqueue read doesn’t return? Are you using semaphores? When the thread is in Reply state it is waiting for mq or mqueue to reply. When data gets on the queue it probably does. I don’t know why an mqueue routine would do a semaphore wait, so maybe your code is doing it?