Subject: Re: use of wakeup_one by kern_lock.c vs. mixed shared/exclusive locks..
To: Darren Reed <darrenr@reed.wattle.id.au>
From: Jaromír <jdolecek@netbsd.org>
List: tech-kern
Date: 09/30/2001 12:06:45
Darren Reed wrote:
> > Moreover, doing a wakeup_one() when there are multiple *readers*
> > waiting doesn't make any sense; it would seem that the only time
> > wakeup_one() would be safe is if a lock is *only* used exclusively.
>
> Is there something we can do to code this rule into place ?
>
> For example, make wakeup_one() panic when it sees this condition, or
> automatically call wakeup() instead, maybe ?
wakeup_one() exits as soon as it sees (and awakens) first process
with matching ident. It's a speedy wakeup() when you know there is
only one process waiting on the channel.
It's my understanding the right answer is to either restructure
the code so that indeed there would be just one waiter (or the
awakened process would awaken others), or use wakeup().
Jaromir
--
Jaromir Dolecek <jdolecek@NetBSD.org> http://www.ics.muni.cz/~dolecek/
NetBSD - just plain best OS! -=*=- Got spare MCA cards or docs? Hand me them!