Kaydet (Commit) 0e351f34 authored tarafından Guido van Rossum's avatar Guido van Rossum

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

Solaris and Linux: use os.O_NONBLOCK.
üst d7763621
...@@ -12,9 +12,9 @@ filename = '/tmp/delete-me' ...@@ -12,9 +12,9 @@ filename = '/tmp/delete-me'
# the example from the library docs # the example from the library docs
f = open(filename,'w') 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: 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) lockdata = struct.pack('hhllhh', FCNTL.F_WRLCK, 0, 0, 0, 0, 0)
if verbose: if verbose:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment