mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
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:
parent
d77636216c
commit
0e351f34c5
1 changed files with 2 additions and 2 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue