nonblocking i/o on windows?

craig curtin curtin at ubsw.com
Tue Mar 12 12:35:56 EST 2002


skip,
how about:
    hnd=win32file.FindFirstChangeNotification(d , 0,  
winnt.FILE_NOTIFY_CHANGE_LAST_WRITE )
    win32event.WaitForSingleObject(hnd, -1)

craig

Skip Montanaro <skip at pobox.com> wrote in message news:<mailman.1015884859.11150.python-list at python.org>...
> At the end of asyncore.py a non-blocking file_dispatcher class is defined
> like so:
> 
>     class file_dispatcher (dispatcher):
>         def __init__ (self, fd):
>             dispatcher.__init__ (self)
>             self.connected = 1
>             # set it to non-blocking mode
>             flags = fcntl.fcntl (fd, fcntl.F_GETFL, 0)
>             flags = flags | os.O_NONBLOCK
>             fcntl.fcntl (fd, fcntl.F_SETFL, flags)
>             self.set_file (fd)
> 
>         def set_file (self, fd):
>             self._fileno = fd
>             self.socket = file_wrapper (fd)
>             self.add_channel()
> 
> Unfortunately, this uses fcntl, which is only available on Unix systems.  Is
> there something similar on Windows that will allow me to put a Python file
> object in non-blocking mode?  I thought perhaps there would be something
> defined in msvcrt, but I didn't see anything in the lib ref manual or the
> msvcrt source.
> 
> Thx,



More information about the Python-list mailing list