jthread and handleIO(true)

Godmar Back gback at cs.utah.edu
Thu Nov 19 09:57:53 PST 1998


> 
> The general case is:
>   . A thread waits for a small time.
>   . All other threads are SUSPENDED (maybe I/O or ALARM)
>   . SIGALRM is received while reschedule() loop and marked as pending.
>   . reschedule() call handleIO(true) and wait for an I/O event or
>     an alarm event before process pending signals.
> 
> I think you should check sigPending in reschedule() before called
> handleIO(true) as:
> 
> 	if (sigPending)
> 		processSignals()
> 	else {
> 		if (DBGEXPR(DETECTDEADLOCK...
> 		handleIO(true);
> 	}
> 

 This wouldn't fix it, would it?

You're still have the possible race condition because your test of
sigPending and the call to handleIO(and then select) are not atomic.

It appears that blocking signals before we go into the select is the
only way to really fix that.  That shouldn't hurt us much, though,
since it'll only happen when the system is about to go idle in select.

	- Godmar



More information about the kaffe mailing list