Richard Oudkerk added the comment:

> select() other than being supported on all platforms has the advantage of 
> being simple and quick to use (you just call it once by passing a set of fds 
> and then you're done).

Do you mean at the C level?  Wouldn't you just do

  struct pollfd pfd = {fd, POLLIN, 0};
  if (poll(&pfd, 1, timeout) < 0) {...}
  ready = pfd.revents != 0;

That does not look any less simple and quick.

> on the other hand you introduce a considerable slowdown given the amount 
> of operations involved and described above.

poll(), unlike select(), does not have to scan an fd_set (of 1024 bits?) so I 
would have expected it to be faster if anything.

At the python level creating a new poll object each time might indeed be 
slower, but one could always cache it on the queue object.

BTW, are there any non-Windows platforms which support multiprocessing but 
don't have poll()?  (On Windows WaitForSingleObject() is used instead.)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16269>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to