logo
Published on KernelTrap (http://kerneltrap.org)

help required for select system call

By
Created Apr 25 2008 - 02:18

Hello

In my program main thread is waiting on select in a while loop. If select returns error program comes out. Now I need to implement a signal handler code to the program. I added the code. What is happening is, when ever I sent a SIGUSR1 signal to the process, select returns -1 and it is considered as error. But I am not able to make out select returns error becuase of signal or not. How to do I handle this condition. What I want to do is, if select return -1 becuase of SIGUSER1 signal, continue in the loop other wise exit from the program.

while(1) {

ret_val = select (...)
if (ret_val < 0) {
if ( SIGUSER1) { continue; }
else { exit from program }
}
}

Thanks in advance
-Baloon-


Source URL:
http://kerneltrap.org/node/16045