You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried using the default fcntl lock with a daemon process (one generated by python-daemon package) but was running into a few issues. Notably I could not write my PID to a file, nor could I read it back with that style of locking. I can do those with the BSD style flock.
And provides the following snippet:
class_FlockLock(_InterProcessLock):
"""Interprocess lock implementation that works on posix systems based on https://www.man7.org/linux/man-pages/man2/flock.2.html."""@staticmethoddef_trylock(lockfile):
fileno=lockfile.fileno()
fcntl.flock(fileno, fcntl.LOCK_EX|fcntl.LOCK_NB)
@staticmethoddef_unlock(lockfile):
fileno=lockfile.fileno()
fcntl.flock(fileno, fcntl.LOCK_UN)
The text was updated successfully, but these errors were encountered:
@redramen writes:
I tried using the default fcntl lock with a daemon process (one generated by python-daemon package) but was running into a few issues. Notably I could not write my PID to a file, nor could I read it back with that style of locking. I can do those with the BSD style flock.
And provides the following snippet:
The text was updated successfully, but these errors were encountered: