lkml.org 
[lkml]   [2008]   [Mar]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/5] lib: introduce call_once()
On Tue, 11 Mar 2008 11:56:55 -0700
Joe Perches <joe@perches.com> wrote:

> On Tue, 2008-03-11 at 10:35 -0700, Andrew Morton wrote:
> > #define ONCE() \
> > ({ \
> > static long flag; \
> > \
> > return !test_and_set_bit(0, flag); \
> > })
>
> test_and_set_bit takes an address

duh.

> Perhaps:
>
> #define DO_ONCE(x) \
> ({ static long flag; if (test_and_set_bit(0, &flag)) x; 1; })
>
> DO_ONCE(foo);

No, that's completely unnecessary and would produce nasty-looking code.
Take a look at some of the wait_event monstrosities we have.


I'm not sure that we need any of this once() stuff really.


\
 
 \ /
  Last update: 2008-03-11 20:15    [W:0.089 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site