locking primatives

John Baldwin jhb at FreeBSD.org
Wed Mar 31 12:55:51 PST 2004


On Saturday 27 March 2004 03:33 pm, Colin Percival wrote:
>   I'm trying to implement a callout_stop_safe() function
> (same as callout_stop(), except that it would wait for the
> callout to finish if it is currently in progress) in order
> to get around a rather nasty panic in the kqueue code.  All
> I need to do is block until the softclock thread reaches a
> specified point -- this is pretty much the simplest locking
> problem possible.
>   Is there any introduction to the various locking methods
> which would give me some indication of which one I should
> use?

Heh, it's actually not a trivial problem.  For one way of dealing with this 
race, see the TDF_TIMOFAIL / TDF_TIMEOUT handling stuff in subr_sleepqueue.c.

-- 
John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the freebsd-smp mailing list