[PyQT] QSocketNotifier problem
jepler at unpythonic.net
Thu Mar 11 17:45:02 CET 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.
More information about the Python-list