home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
linuxmafia.com 2016
/
linuxmafia.com.tar
/
linuxmafia.com
/
pub
/
palmos
/
pippy-0.6beta-src.tar.gz
/
pippy-0.6beta-src.tar
/
pippy-0.6beta-src
/
src
/
Lib
/
lib-old
/
lockfile.py
< prev
next >
Wrap
Text File
|
2000-12-21
|
288b
|
16 lines
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))