Difference between revisions of "Python fcntl Test"
Jump to navigation
Jump to search
PeterHarding (talk | contribs) (New page: <pre> #! /usr/bin/env python2.2 """Test program for the fcntl C module. Roger E. Masse """ import struct import fcntl import os, sys import datetime curr = datetime.datetime.now() pr...) |
(No difference)
|
Latest revision as of 18:22, 24 May 2008
#! /usr/bin/env python2.2 """Test program for the fcntl C module. Roger E. Masse """ import struct import fcntl import os, sys import datetime curr = datetime.datetime.now() print curr sys.exit(0) filename = sys.argv[1] # Again, but pass the file rather than numeric descriptor: f = open(filename, 'a+') rv = fcntl.flock(f, fcntl.LOCK_EX) import time time.sleep (60) rv = fcntl.flock(f, fcntl.LOCK_UN) f.close()