taskqueue_create() name parameter lieftime

Pawel Jakub Dawidek pjd at FreeBSD.org
Tue Nov 16 13:42:27 UTC 2010

On Tue, Nov 16, 2010 at 08:27:11AM -0500, John Baldwin wrote:
> On Tuesday, November 16, 2010 7:20:47 am Andriy Gapon wrote:
> > 
> > taskqueue_create() documentation never explicitly says this, but current
> > taskqueue_create() implementation just stores a 'name' pointer parameter
> > internally.  Thus it depends on the 'name' having a life time encompassing that of
> > the taskqueue.
> > I think that alternatively we could have copied the name (or a portion of it) into
> > an internal buffer.
> > I don't any argument for either approach, just curious which one looks more
> > preferable from general (FreeBSD, kernel) programming practices point of view.
> Hmm, in many other places we store a separate copy (e.g. all the interrupt
> code uses separate MAXCOMLEN char arrays to hold names).  If that is easy to
> do, that is probably the best approach.

The most friendly API would keep the name internally, but would also
allow me to provide name in printf-like format, so I don't have to use
sprint()/snprintf() before calling it. This unfortunatelly will change
taskqueue API as name is the first argument, which makes it not worth
the pain.

Pawel Jakub Dawidek                       http://www.wheelsystems.com
pjd at FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20101116/6791543b/attachment.pgp

More information about the freebsd-current mailing list