Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Jun 2007 17:17:22 +0200
From:      Hans Petter Selasky <hselasky@c2i.net>
To:        freebsd-hackers@freebsd.org
Cc:        hackers@freebsd.org, Artis Caune <Artis.Caune@latnet.lv>
Subject:   Re: stopping callouts
Message-ID:  <200706011717.22179.hselasky@c2i.net>
In-Reply-To: <465FF29B.3010307@latnet.lv>
References:  <465FF29B.3010307@latnet.lv>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 01 June 2007 12:19, Artis Caune wrote:
> Hello FreeBSD-hackers!
>
> what is the right way to stop callout which is initialized with mutex:
>    callout_init_mtx(&callout_function, &my_mtx, 0);
>
> should I lock mutex before calling callout_drain() or not?
>
> man page says: callout_drain() is identical to callout_stop() and
> if the callout has an associated mutex, then that mutex must be held
> when callout_stop() is called.
>

You should call "callout_drain()" w/o any locks held, because this function 
might sleep.

callout_drain() is not identical to callout_stop(). Then man-page should be 
updated.

--HPS



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200706011717.22179.hselasky>