Mutex in shared memory when one user crashes?

后端 未结 5 2052
甜味超标
甜味超标 2020-12-29 08:05

Suppose that a process is creating a mutex in shared memory and locking it and dumps core while the mutex is locked.

Now in another process how do I detect that mute

5条回答
  •  灰色年华
    2020-12-29 08:28

    If you're working in Linux or something similar, consider using named semaphores instead of (what I assume are) pthreads mutexes. I don't think there is a way to determine the locking PID of a pthreads mutex, short of building your own registration table and also putting it in shared memory.

提交回复
热议问题