Staging
v0.5.1
https://github.com/python/cpython
Revision d56924258ad798622f09e5b835de23fabfbd2e3a authored by Fred Drake on 11 December 1997, 21:46:07 UTC, committed by Fred Drake on 11 December 1997, 21:46:07 UTC
	index to cross-references; an image doesn't benefit by being bold!
1 parent 9e32666
Raw File
Tip revision: d56924258ad798622f09e5b835de23fabfbd2e3a authored by Fred Drake on 11 December 1997, 21:46:07 UTC
add_idx(): Don't add unnecessary markup around the little markers stuck in the
Tip revision: d569242
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