Staging
v0.5.1
https://github.com/python/cpython
Revision 8813b58ffa6d83522ad2bbec0437c5c0e52a7ba9 authored by Guido van Rossum on 07 May 1997, 17:42:41 UTC, committed by Guido van Rossum on 07 May 1997, 17:42:41 UTC
1 parent aa948df
Raw File
Tip revision: 8813b58ffa6d83522ad2bbec0437c5c0e52a7ba9 authored by Guido van Rossum on 07 May 1997, 17:42:41 UTC
On popular demand, re-enable the readline event hook.
Tip revision: 8813b58
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))
back to top