Is there a way to clean up shared POSIX synchronization objects, especially if the process crashes? Locked unlocks of POSIX semaphores are the most desirable thing, but automatically “collected” queues / shared memory area would also be good. Another thing to watch out for is that we cannot use signal handlers at all because of SIGKILL, which cannot be caught.
I see only one alternative: some external daemon that accepts subscriptions and "keep-alive" requests that work as a watchdog timer, so without any notifications about any object, it could close / unlock the object in accordance with the registered policy.
Does anyone have a better alternative / suggestion? I have never seriously worked with POSIX shared objects (sockets were enough for all my needs and much more useful in my opinion), and I did not find a suitable article. I would love to use sockets here, but could not for historical reasons.
source share