Ok so the queue is available to both threads therefore it needs to be thread safe. I assume you don't know what this means otherwise you wouldn't have asked such a question. I'm afraid you have a bit of background reading to do, but I will just give you a quick overview.
When data can be changed <edit>or viewed</edit> by more than one thread, you need to implement mutex's, what this does is ensure only one thread can access or change the data. Without them there is no guarantee that the data will be safe and may well be corrupt by the two threads.;(
This could also be done with semaphores.
If using c++ you could make your own template queue (of the std::queue) and include a mutex inside the class to hide the locking and unlocking to ensure safe data.
If using c you could create your own queue structure and once again implement the mutex inside it.
Another thing to look at is condition variables, with this your thread which is getting the msgs out the queue could could be awoken when there is a msg which has been placed in the queue, But before sending this thread back to sleep waiting for a wakeup call it should check that there are no msg's in the queue already. Otherwise a wakeup may have been sent when the thread it was intended for was already awake and working it would then go to sleep, but there would be a msg waiting to be processed. This will not be seen until another msg was pushed into the queue.
Ive tried to keep this short, but in reality it is a large subject. heres a link you should check out.
http://www.yolinux.com/TUTORIALS/Lin...ixThreads.html