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

From: Joe Perches
Date: Tue Mar 11 2008 - 14:59:20 EST


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);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/