Is there any locking interface for Python that automatically breaks the lock when the process dies? I was under the impression that sysv ipc allows for that, but I’m still trying to figure out the details.
What I expect from the interface:
- lock / release functions
- working between different processes on Linux
- automatic unlock when the process holding the lock dies
- forced lock breaking on timeout (not necessary)
You could apply locks to a file using
fcntl.lockforfcntl.flock. That seems to meet all your criteria. Or do you need something that doesn’t require a system call every time you want to lock or unlock?