Poll'able Queue objects.

David Bolen db3l at fitlinxx.com
Tue Mar 13 19:35:59 EST 2001


grante at visi.com (Grant Edwards) writes:

> The mind wobbles.  One of the things that Unix got right is that you can
> select() (or poll()) on pipes, sockets, serial ports (any properly written
> character device that's properly written), or, in degenerate-case sort of
> way, "regular" files.  The fact that MS could take such a giant step
> backwards demonstrates either a monumental lack of knowledge about OS's or a
> monumental amount of conceit.  Probably a combination of both.

Actually, the depressing part is that they really did a decent job
with most of their objects but ended just shy of really covering
everything.  You can wait on a mixture of most any kernel objects
under Win32, and for other actions (like file I/O) the action can be
queued asynchronously and coupled to generic event objects that are
also waitable.  The inability to do overlapping (and non-blocking) I/O
on anonymous pipes is one of those misses that causes me no end of
annoyance.

It's really the select() implementation in WinSock that got messed up,
as it only works on sockets, which makes porting much more difficult.
But if you're willing to use the Win32 API, you can incorporate a
socket into the more general WaitForMultipleObjects by linking any of
a series of actions on the socket (e.g., ready to read, write, notify
on incoming connection, etc...) to a Win32 event object, which can
then play nicely with other objects in a general wait operation.

It's not the Unix approach of select() on file handles while
incorporating most everything under a device driver model with file
handles, but it's different, not necessarily terrible.  As someone
else pointed out, Unix has grown it's own share of system objects that
are incompatible with the select() approach.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list