I am going to synchronize two different processes on Linux. Both processes wants to get access to a device, which can be used by one process at the same time. Until now, I was using a named semaphore for synchronization and it was operating well, until someone killed process currently operating on device. In this situation semaphore is not being released, which results in hang of all processes trying to acquire the semaphore / access device.
This can be simple solved under Windows with a mutex. In this system, named mutex is automatically released when owning thread/process is terminated.
I will be grateful for all comments and/or solutions on Linux.
Thanks in advance! Toreno