select() interruption by signal

Robert Longstaff spooky at dreamfish.freeserve.co.uk
Mon Oct 11 13:44:59 EDT 1999


In my app I have a select() call inside a continuous loop waiting for 
asynchronous data input from various connected sources. As this call blocks 
and I need to perform other mini tasks I have an alarm call that fires 
every 2s that is reset inside its handler.

However I've found that this alarm signal, although being caught 
successfully by the handler, also interrupts the select() causing the app 
to bomb out:

Traceback (innermost last):
  File "./myapp.py", line 169, in ?
    inList, outList, specialList = select.select(select_mask, [], [])
select.error: (4, 'Interrupted system call')

Is this just a timing thing? Is the select() 'catching' the signal at the 
same time as the handler or is the signal 'hanging around' longer than it 
should?

Is there an option to get the select() to ignore signals or should I trap 
the exception (and throw it away)? I can't find any more information in the 
Python manual or man select. I'm using v1.5.1 on Linux.

Thanks in advance.

Robert.

P.S. I thought I'd ask this as a more 'general' question before including 
any source.  




More information about the Python-list mailing list