Finally found a wat to set a file nonblocking that works on Irix,

Solaris and Linux: use os.O_NONBLOCK.
This commit is contained in:
Guido van Rossum 1997-05-12 22:15:52 +00:00
parent d77636216c
commit 0e351f34c5

View file

@ -12,9 +12,9 @@ filename = '/tmp/delete-me'
# the example from the library docs
f = open(filename,'w')
rv = fcntl.fcntl(f.fileno(), FCNTL.F_SETFL, FCNTL.FNDELAY)
rv = fcntl.fcntl(f.fileno(), FCNTL.F_SETFL, os.O_NONBLOCK)
if verbose:
print 'Status from fnctl with O_NDELAY: ', rv
print 'Status from fnctl with O_NONBLOCK: ', rv
lockdata = struct.pack('hhllhh', FCNTL.F_WRLCK, 0, 0, 0, 0, 0)
if verbose: