lkml.org 
[lkml]   [2002]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRace: SignalHandler() & sleep()
Hello

main()
{
....
signal (SIGIO, signalhandler() ) ;
....
sleep (65535) ;
....
}

signalhandler() { ... }

Assume the frequency of IO events is faster than one
event per 65535 seconds. Therefore, let's consider
65535 as infinity (sleeping foreveR).
If a SIGIO arrives, main will get out of sleep and
continue running, but signalhandler will be invoked
too. I wanted to know if there is any order/priority
for sleep() in main, and signalhandler() to be called
first, or one of them is invoked first randomly (race
condition) ?

I myself ran the program many times and everytime
observed signalhandler responding first. But maybe it
is not a rule, and it was just my chance ?

Thnx for your comment !

--Hossein Mobahi


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:26    [W:0.034 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site