Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jul 2002 17:25:17 -0700 (PDT)
From:      Archie Cobbs <archie@dellroad.org>
To:        Jonathan Lemon <jlemon@flugsvamp.com>
Cc:        Archie Cobbs <archie@dellroad.org>, John Baldwin <jhb@FreeBSD.ORG>, davidx@viasoft.com.cn, freebsd-arch@FreeBSD.ORG, julian@elischer.org
Subject:   Re: Timeout and SMP race
Message-ID:  <200207110025.g6B0PHA30341@arch20m.dellroad.org>
In-Reply-To: <20020710171552.F65393@prism.flugsvamp.com> "from Jonathan Lemon at Jul 10, 2002 05:15:52 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
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




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