A deadlock occurs when one or more threads are stuck waiting for something that never will occur.
A simple type of deadlock may occur when the same thread attempts to lock a mutex twice in a row.
Deadlocks can occur when two (or more) threads are each blocked, waiting for a condition to occur that only the other one can cause. For instance, if thread A is blocked on a condition variable waiting for thread B to signal it, and thread B is blocked on a condition variable waiting for thread A to signal it, a deadlock has occurred because neither thread will ever signal the other.You should take care to avoid the possibility of such situations because they are quite difficult to detect. [-advanced linux programming]