Asyncore select statement problem

JamesHoward James.w.Howard at gmail.com
Fri Jan 19 18:48:12 EST 2007


Again, thank you for your help.  With digging through the Asyncore.py
source, I was able to find the poll2 function which is called when the
function asyncore.loop(use_poll = True) is enabled.

This function does not use a select call, but a poll call to do its
looping.  It works well for the problem of threads closing devices at
unknown times.  The reason for this is that the select statement is
called on a series of file descriptors that should not be changed.  If
the file descriptors become invalid, select throws and exception and
the asyncore loop haults.  The use_poll flag sets the asyncore module
to use a poll instead of a select statement.

Within the poll method, there are better ways of dealing with file
descriptors and they seem to be able to discern if a file descriptor
becomes disconnected with the POLLHUP flag.

I am still unsure as to why the select function is used instead of the
poll function, but using poll appears to have solved my problem.

Thanks for all the help,
Jim Howard




More information about the Python-list mailing list