The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 06-02-2007
porter porter is offline
Registered User
 

Join Date: Jan 2007
Posts: 2,965
Have a look here Multiplexing with curses.

You need to treat the signals as another stream of input.

A common technique I use is to create a pipe and include it as one of the input sources in a select(...) loop, in the signal handler I write a single byte to the pipe (usually the signum) and in the event loop I read the pipe.

This avoids all the messyness of missing signals or interrupt system calls. All the signals end up queued in the pipe ready to be read following the select.
Reply With Quote