Re: [PATCH 1/5] lib: introduce call_once()

Joe Perches
2008-03-11T18:59:19Z

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

Perhaps:

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

DO_ONCE(foo);