lkml.org 
[lkml]   [2008]   [Jan]   [20]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
FromJohannes Weiner <>
SubjectRe: [PATCH 2/6] typesafe: kthread_create and kthread_run
DateSun, 20 Jan 2008 17:24:42 +0100
Hi,

"Bert Wesarg" <bert.wesarg@googlemail.com> writes:

> On Jan 20, 2008 12:25 PM, Jan Engelhardt <jengelh@computergmbh.de> wrote:
>>
>> On Jan 20 2008 20:48, Rusty Russell wrote:
>> >+ */
>> >+#define kthread_create(threadfn, data, namefmt...) ({         \
>> >+      int (*_threadfn)(typeof(data)) = (threadfn);            \
>> >+      __kthread_create((void *)_threadfn, (data), namefmt);   \
>> >+})
>>
>> If you have namefmt... you need that varagrs cpp trick. IIRC:
>>
>>         __kthread_create((void *)_threadfn, (data), namefmt, __VA_ARGS__);
> almost
>
> either:
>
> #define kthread_create(threadfn, data, ...) ({         \
>         __kthread_create((void *)_threadfn, (data), __VA_ARGS__);
>

No.  This is bad because it gives the impression that it takes only two
essential arguments which is not the case.

> or:
>
> #define kthread_create(threadfn, data, namefmt, ...) ({         \
>         __kthread_create((void *)_threadfn, (data), namefmt, ##__VA_ARGS__);
>

This is better.  I prefer naming the rest args instead of using __VA_ARGS__:

#define kthread_create(threadfn, data, namefmt, fmtargs...) ({ \
	... \
	__kthread_create((void *)_threadfn, (data), namefmt, ##	fmtargs) \
})
but I think that is just a matter of taste.

	Hannes


\
 
 \ /
  Last update: 2008-01-20 16:29    [from the cache]
©2003-2008