Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Deadlock can happen when multiple threads each holds a lock the other needs and are waiting for each other to release the resource. One way to fix the problem is to avoid circular wait by locking the mutex in a predefined order.

Noncompliant Code Example