Hi folks,

I need a solution for following scenario.

1. Suppose two processes running simulteneously.
2. Process (P1) has already locked a mutex (M1).
3. Process (P2) is trying to lock same mutex (M1) but as it is already locked by (P1), P2 is waiting for unlocking (M1).
4. Now somehow process (P1) terminates or dies wihtout unlocking mutex (M1).
5. (P2) is still waiting for unlocking (M1). But as (P1) is dead now there is no other way to unlock the mutex.
6. In this situation, (P2) experiences a deadlock.

How to resolve this kind of situation.

Recommended Answers

All 2 Replies

In MS-Windows WaitForSingleObject() you can specify a time limit for the lock to happen.

Thanks 'Ancient Dragon'.

Any idea how to resolve it on Unix/Linux platforms?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.