Hi all.
I'm esperiencing a SIGIO-related problem in a C++ program I'm working on.
- Platform: Linux 2.6.30, x86 Arch
- Scenario: async serial communication.
I followed this async-communication example from the Linux Serial Programming HowTo and it worked flawlessy.
Then I removed the "sleep+check wait_flag" thing and now I handle the read() part directly in signal_handler_IO(). That is, when some input is available, the signal handler is called and it forces a read on the serial port (*).
My code seems to work but unfortunately when new input is available the SIGIO signal is raised several times so I get spurious/incomplete reads (each SIGIO received forces a read).
I changed VMIN and VTIME serial options to control the read buffer (i.e. VMIN=255/VTIME=15, VMIN=50/VTIME=0, ...). I tried setting SA_SIGINFO flag (as suggested by some), but no success.
So:
- what am I missing about SIGIO raising/handling?
- is there a way to avoid this "SIGIO storm"?
- is there any way to control SIGIO raising policies?
Thanks in advance.
Bye.
(*): actually I'm following this C++ FAQ Lite hint so the signal handler calls a member function of an object that encapsulates all my serial handling stuff. Unfortunately the problem still happens, even if I invoke read() in the signal handler itself.