cvs commit: src/sys/kern kern_proc.c
Lukas Ertl
le at FreeBSD.org
Wed Jun 9 16:29:28 GMT 2004
On Wed, 9 Jun 2004, Poul-Henning Kamp wrote:
> Assume foo->refcount = 2;
>
> thread1 (low priority) thread2 (high priority)
> ---------------------- -----------------------
>
> ... ...
> LOCK(foo->lock) ...
> i = --foo->refcount; LOCK(foo->lock)
> # i == 1, refcount == 1
> UNLOCK(foo->lock)
> i = --foo->refcount;
> # i == 0, refcount == 0
> UNLOCK(foo->lock)
> if (i == 0) # true
> destroy(foo)
> ...
>
> if (i == 0) # false
> destroy(foo)
Is there a possibility that foo->refcount is incremented after both of
them left the critical section, so that i is 0, but foo->refcount isn't?
cheers,
le
--
Lukas Ertl http://homepage.univie.ac.at/l.ertl/
le at FreeBSD.org http://people.freebsd.org/~le/
More information about the cvs-src
mailing list