wakeup() race condition. (theory)

Lars Pensj| lars at myab.se
Wed Nov 30 00:46:40 AEST 1988


In article <1974 at van-bc.UUCP> sl at van-bc.UUCP (pri=-10 Stuart Lynne) writes:
>		x = spl(5);
>		state |= IAmAsleep;
>		sleep(...)
>		splx(x);

Just a note about this. It should be

		x = spl(5);
		state |= IAmAsleep;
!		while (state & IAmAsleep)
!		    sleep(...);
		splx(x);

because sleep() may wake through other wakeup() with unknown codes.

--------------
Lars Pensj|
lars at myab.se
-- 
    Lars Pensj|
    lars at myab.se



More information about the Comp.unix.wizards mailing list