in reply to Re: Re: Re: Re: Handling I/O Signals
in thread Handling I/O Signals

  1. Eventually the while(1) will yield to the signal. It depends on the OS and how perl works. It may not be immediate. In Linux/UNIX signals are only delivered to a program when it "wakes up"; that is, when it starts to run after having let another process use the CPU.
  2. True, select "blocks" until input. Your while(1){}; just consumes the CPU until input happens.
  3. In the C code if data comes to the port while printf is printing, the printf may be interrupted for the signal and the flag would be set indicating data were present. That is why the  STOP==FALSE test is there.
  4. Since you have the while(1) loop and it is empty in your example, you could do something like:
    while(1){ wait for input via select process input }
    This is used in blocking network servers
--traveler