From owner-freebsd-arch Wed Jul 10 17:45:12 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 063A237B401; Wed, 10 Jul 2002 17:45:10 -0700 (PDT) Received: from InterJet.dellroad.org (adsl-63-194-81-26.dsl.snfc21.pacbell.net [63.194.81.26]) by mx1.FreeBSD.org (Postfix) with ESMTP id 98D9B43E72; Wed, 10 Jul 2002 17:45:05 -0700 (PDT) (envelope-from archie@dellroad.org) Received: from arch20m.dellroad.org (arch20m.dellroad.org [10.1.1.20]) by InterJet.dellroad.org (8.9.1a/8.9.1) with ESMTP id RAA71066; Wed, 10 Jul 2002 17:25:52 -0700 (PDT) Received: (from archie@localhost) by arch20m.dellroad.org (8.11.6/8.11.6) id g6B0PHA30341; Wed, 10 Jul 2002 17:25:17 -0700 (PDT) (envelope-from archie) From: Archie Cobbs Message-Id: <200207110025.g6B0PHA30341@arch20m.dellroad.org> Subject: Re: Timeout and SMP race In-Reply-To: <20020710171552.F65393@prism.flugsvamp.com> "from Jonathan Lemon at Jul 10, 2002 05:15:52 pm" To: Jonathan Lemon Date: Wed, 10 Jul 2002 17:25:17 -0700 (PDT) Cc: Archie Cobbs , John Baldwin , davidx@viasoft.com.cn, freebsd-arch@FreeBSD.ORG, julian@elischer.org X-Mailer: ELM [version 2.4ME+ PL88 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Jonathan Lemon writes: > > extern int timer_start(timer_handle_t *handlep, mutex_t *mutexp, > > timer_func_t tfunc, void *arg, u_int delay, > > int flags); > > extern void timer_cancel(timer_handle_t *handlep); > > extern int timer_remaining(timer_handle_t handle, u_int *delayp); > > It seems to me that we can achieve the same functionality without > changing the callout API too much. You mention that the mutex (if supplied) > will be acquired before calling tfunc. This means that it has to be > stored somewhere, presumably in the callout structure itself. > > The callout() consumers typically allocate their own storage, so perhaps > we should add an (optional) pointer to a mutex to the callout structure, > where the mutex is obtained/released before the callout function is made. Yep, that would work too.. essentially it's the same thing. If you're doing that, why not just store the mutex itself in the callout structure, rather than a pointer to it? I guess if you did that then you would then need some kind of flag that says whether to use it or not. Or.. maybe there would be some way for the timer code to tell if the mutex has been initialized or not, and use this to decide whether to use it or not? -Archie __________________________________________________________________________ Archie Cobbs * Packet Design * http://www.packetdesign.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message