Mercurial > cpython-lru_cache-weakref
view Lib/lib-old/lockfile.py @ 5817:48b94de85bf3 legacy-trunk
Extensive changes by AMK.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 17 Jul 1997 16:29:42 +0000 |
| parents | c2ff2163f0b7 |
| children | 65e26113b3fb |
line wrap: on
line source
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))
