[PyQT] QSocketNotifier problem

Jeff Epler jepler at unpythonic.net
Thu Mar 11 11:45:02 EST 2004


I suspect that QSocketNotifier is built on top of poll or select.  The
documentation I have for poll is too terse for me to be sure, but I
suspect POLLIN behaves like the readfs set in select.  The documentation
for select makes it clear that "readable" means that reading will not
block---so an end-of-file condition counts.

I'm not sure how you're really supposed to deal with this in a way that
doesn't block, doesn't spin, and doesn't involve doing something based
off a timer.  Here's one idea that does involve a timer:

When reading the FIFO indicates an end-of-file condition, close the
fifo.  Then, at intervals, attempt to reopen it.  When opened with
O_NONBLOCK, the open fails with ENXIO if there is no writer.

Ensuring that there's always a writer for the FIFO might work too,
because then poll/select will not detect an end-of-file condition.

Jeff




More information about the Python-list mailing list