svn commit: r181191 - in head: share/man/man9 sys/kern sys/sys

Sam Leffler sam at freebsd.org
Mon Aug 4 15:33:16 UTC 2008


John Baldwin wrote:
> On Saturday 02 August 2008 01:42:39 pm Sam Leffler wrote:
>   
>> Author: sam
>> Date: Sat Aug  2 17:42:38 2008
>> New Revision: 181191
>> URL: http://svn.freebsd.org/changeset/base/181191
>>
>> Log:
>>   add callout_schedule; besides being useful it also improves
>>   compatibility with other systems
>>
>>   Reviewed by:	ed, battlez
>>     
>
> I think it probably warrants a KASSERT() that c_func isn't NULL to catch the 
> case of someone doing:
>
> 	callout_init(...);
>
> 	callout_schedule(...);
>   

Sure, go for it.  This was just the N'th time I'd noticed 
callout_schedule was missing when bringing code over from another system...

> I'd almost prefer that we add (func, arg) pointers to the init routines so you 
> do this:
>
> 	callout_init_mtx(&sc->timer, &sc->lock, timer_func, sc);
>
> 	...
>
> 	callout_schedule(&sc->timer, hz);
>
> Right now you have to make sure you do at least one 'callout_reset' before you 
> do a 'callout_schedule' which seems bug-prone.
>
>   
In most cases this is the more natural usage.  It binds the callback to 
the timer while the current api provides an independent timer object 
that you can bind multiple callbacks to.  I wasn't trying to change the 
existing model.  I can't recall what phk's new api looks like in this 
regard.

    Sam



More information about the cvs-all mailing list