From owner-freebsd-hackers@FreeBSD.ORG Fri Jun 1 15:17:33 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 51AE116A421 for ; Fri, 1 Jun 2007 15:17:33 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe01.swip.net [212.247.154.1]) by mx1.freebsd.org (Postfix) with ESMTP id 44E4E13C4BF for ; Fri, 1 Jun 2007 15:17:32 +0000 (UTC) (envelope-from hselasky@c2i.net) X-Cloudmark-Score: 0.000000 [] Received: from [194.248.135.20] (account mc467741@c2i.net HELO laptop.lan) by mailfe01.swip.net (CommuniGate Pro SMTP 5.1.7) with ESMTPA id 488543002; Fri, 01 Jun 2007 17:17:30 +0200 From: Hans Petter Selasky To: freebsd-hackers@freebsd.org Date: Fri, 1 Jun 2007 17:17:22 +0200 User-Agent: KMail/1.9.5 References: <465FF29B.3010307@latnet.lv> In-Reply-To: <465FF29B.3010307@latnet.lv> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200706011717.22179.hselasky@c2i.net> Cc: hackers@freebsd.org, Artis Caune Subject: Re: stopping callouts X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2007 15:17:33 -0000 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