Xref: utzoo comp.unix.xenix:4040 comp.unix.wizards:13025
Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!cwjcc!hal!nic.MR.NET!uwmcsd1!marque!uunet!mcvax!enea!kth!draken!chalmers!myab!lars
From: lars@myab.se (Lars Pensj|)
Newsgroups: comp.unix.xenix,comp.unix.wizards
Subject: Re: wakeup() race condition. (theory)
Keywords: wakeup sleep spl
Message-ID: <447@myab.se>
Date: 29 Nov 88 14:46:40 GMT
References: <455@mrecvax.UUCP> <1974@van-bc.UUCP>
Reply-To: lars@myab.se (Lars Pensj|)
Organization: Myab Gothenburg, Sweden
Lines: 22

In article <1974@van-bc.UUCP> sl@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@myab.se
-- 
    Lars Pensj|
    lars@myab.se