login
Header Space

 
 

help required for select system call

April 25, 2008 - 2:18am
Submitted by Anonymous on April 25, 2008 - 2:18am.
Linux

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-

check errno for EINTR

April 25, 2008 - 12:21pm
Anonymous (not verified)

check errno for EINTR

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
speck-geostationary