Once.initEnterPointer

This functions behaves in the same way as glib.once.Once.initEnter, but can can be used to initialize pointers (or #guintptr) instead of #gsize.

static MyStruct *interesting_struct = NULL;

if (g_once_init_enter_pointer (&interesting_struct))
  {
    MyStruct *setup_value = allocate_my_struct (); // initialization code here

    g_once_init_leave_pointer (&interesting_struct, g_steal_pointer (&setup_value));
  }

// use interesting_struct here
class Once
static
bool
initEnterPointer
(
void* location
)

Parameters

location void*

location of a static initializable variable containing NULL

Return Value

Type: bool

true if the initialization section should be entered, false and blocks otherwise