2010-01-21 23:42:47 -08:00
|
|
|
#ifndef MOO_ONCE_H
|
|
|
|
#define MOO_ONCE_H
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
#include <mooutils/mooutils-macros.h>
|
|
|
|
|
|
|
|
#define MOO_DO_ONCE_BEGIN \
|
|
|
|
do { \
|
|
|
|
static gsize _moo_do_once = 0; \
|
2011-01-13 00:36:22 -08:00
|
|
|
if (g_once_init_enter (&_moo_do_once)) \
|
2010-01-21 23:42:47 -08:00
|
|
|
{
|
|
|
|
|
|
|
|
#define MOO_DO_ONCE_END \
|
2011-01-13 00:36:22 -08:00
|
|
|
g_once_init_leave (&_moo_do_once, 1); \
|
2010-01-21 23:42:47 -08:00
|
|
|
} \
|
|
|
|
} while (0);
|
|
|
|
|
|
|
|
#endif /* MOO_ONCE_H */
|