9fans archive / 2000 / 08 / 71 /    prev next

From: presotto@pla...
Subject: Re: [9fans] Kernel question: i386 test-and-set problem
Date: Wed, 2 Aug 2000 09:20:00 -0400

If it were at all possible for wakeup to be called with
r already freed, the code would be wrong to begin with
since r is an argument to wakeup.  Sleep and wakeup have to
be syncronized somewhat in the first place just to work.
Wakeup inherenly has to expect that the sleep won't
free r before it's called.  Since the sleep and wakeup
are called by code that knows about the structures the
Rendezvous is kept in, they can do this.  For example,
if we're descending a list that contains rendezvous
structures and the list operations are made atomic,
the structure won't be in the list if the returning
sleep freed it and the wakeup won't find it.

However, that is not true of postnote which is coming out
of left field and doesn't have any knowledge of the
deep structure of the process it is noting.  It can
take into account no invariants implicit in the process
itself.