Staging
v0.8.1
v0.8.1
Revision b6aa92ebf178361e821a1ebffdce6b5fcf96bfae authored by Guido van Rossum on 03 February 1995, 12:50:04 UTC, committed by Guido van Rossum on 03 February 1995, 12:50:04 UTC
1 parent 08e767b
lockfile.py
import struct, fcntl, FCNTL
def writelock(f):
_lock(f, FCNTL.F_WRLCK)
def readlock(f):
_lock(f, FCNTL.F_RDLCK)
def unlock(f):
_lock(f, FCNTL.F_UNLCK)
def _lock(f, op):
dummy = fcntl.fcntl(f.fileno(), FCNTL.F_SETLKW,
struct.pack('2h8l', op,
0, 0, 0, 0, 0, 0, 0, 0, 0))
Computing file changes ...