My app consist of the main-process and two threads, all running concurrently and making use of three fifo-queues:
The fifo-q\'s are Qmain, Q1 and Q2. Internally the
You should not lock second mutex when you already locked one.
Since the question is tagged with C++, I suggest to implement locking inside get/add logic of the queue class (e.g. using boost locks) or write a wrapper if your queue is not a class.
This allows you to simplify the locking logic.
Regarding the sources you have added: queue size check and following put/get should be done in one transaction otherwise another thread can edit the queue in between