A deadlock only occurs when all four of these conditions hold at the same time.
Mutual exclusion. Only one thread can hold a resource at a time.
Hold and wait. A thread holds at least one lock while waiting to acquire another.
No preemption. A lock cannot be forcibly taken away from a thread. It must be released voluntarily.
Circular wait. A closed chain of threads exists where each waits for a resource held by the next.
Loading…