Subject: Re: timedwork
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Iain Hibbert <plunky@rya-online.net>
List: tech-kern
Date: 01/12/2007 21:05:09
On Fri, 12 Jan 2007, YAMAMOTO Takashi wrote:
> unless anyone objects, i'll introduce something like callout(9)
> but its callback function is invoked in a thread context. (see a.diff)
> i want to use it to schedule vmem rehashing. (see b.diff)
>
> we probably will re-consider it when/if we make softclock be handled by
> the interrupt thread.
I don't have any grave objection, but did you consider adding this
capability to the callout(9) API directly?
I'm thinking something like:
callout_init(&c);
callout_setwork(&c, func, arg);
callout_schedule(&c, timeout);
would be simpler? In usage, it would cost checking a flag for each
callout:
if (c->flags & CALLOUT_THREAD) {
/* schedule thread */
} else {
/* call function */
}
.. probably not too expensive?
regards,
iain