Hello,
My question is as follows I have a condition x which I need to signal the current program to begin processing i/o. and when condition x is not met I need the program to sleep. I am pretty sure that the following is correct
while(1)
{
pause();
..
....
}
my question is how do I get it to recognize it's time to send a signal without having it continually poll to see if the condition is met.
//sigHandler defined elsewhere
ie:
signal(SIGHUP,sigHandler); //register signal
while(1)
{
pause(); //have process wait for sig
if( x==4) < -- is this still considered busy wait since it still needs to check to see
//if condition met
{
kill(getpid(),SIGHUP); //where SIGHUP can be any predefined signal in signal.h
}
}
any help would be greatfully appreciated,
Sincerely,
Jim