I have two programs interacting via a shared memory segment. When using the segment for read or write, they hold a lock.
Should either of them crash (get killed, typically - possibly with something untrappable) in a critical section, I would like them to release the lock so that the shmem isn't locked out completely.
Other questions point the way to the answer in Windows, Java, etc. but how do you do it in Unix (and specifically Linux)?
(I'm not attached to the pthreads mutex functions; SysV semaphores or anything else will do just fine.)