[CFR] Kevent timer improvements

Konstantin Belousov kostikbel at gmail.com
Sun Apr 13 20:20:47 UTC 2014


On Sun, Apr 13, 2014 at 09:19:28PM +0200, Baptiste Daroussin wrote:
> On Sun, Apr 13, 2014 at 05:20:28PM +0300, Konstantin Belousov wrote:
> > On Sun, Apr 13, 2014 at 03:15:51PM +0200, Baptiste Daroussin wrote:
> > > I have splitted my patch in multiple parts, let start with the first one:
> > > adding NOTE_NSECONDS, NOTE_USECONDS, NOTE_NSECONDS
> > > 
> > > http://people.freebsd.org/~bapt/kevent_timer.diff
> > 
> [...]
> > > +	else if (flags & NOTE_NSECONDS)
> > > +		modifier = SBT_1NS;
> > It is better to put the 'modifier = SBT_1MS;' statement as the else part.
> > 
> > That said, IMO it would be sometimes beneficial to have real flag to
> > specify milliseconds precision, in addition to milliseconds be the
> > default.
> 
> Done in the new patch
> > > +
> > > +		    timer2sbintime(kn->kn_sdata, kn->kn_sfflags), 0 /* 1ms? */,
> > There, at least the comment about precision should be updated.
> > But, it seems that for the seconds precision, it makes sense to
> > specify e.g. 1/2 sec as precision; or add an API flag to allow imprecise
> > callout scheduling.
> > 
> While I do agree this might be useful I do not have time to work on that right
> now so I just removed the comment which wasn't really accurate anyway.
> 
> Is that ok?
Leave XXX comment right near the zero argument, at least ?

> +	if (flags & NOTE_SECONDS)
> +		modifier = SBT_1S;
> +	else if (flags & NOTE_USECONDS)
> +		modifier = SBT_1US;
> +	else if (flags & NOTE_NSECONDS)
> +		modifier = SBT_1NS;
> +	else
> +		modifier = SBT_1MS;
There should be a case for NOTE_MSECONDS.

Hm, I think the checks should be made stronger. System should ensure
that only one flag is passed, and no invalid flags are supplied, right ?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20140413/a07a0008/attachment.sig>


More information about the freebsd-hackers mailing list