Re: some improvements to gmodule-win32 and gthread-win32

carpentier benoît said:
> in g_thread_impl_init () :
> is it useful to have :
> static gboolean beenhere = FALSE;
> ...
> if (beenhere)
> return;
> beenhere = TRUE;
> why not having initialiszd beenhere to TRUE directly ?

Because otherwise it wouldn't work.  The "static" is very important --- that
means that this variable will hold its value through all invocations of the
function; the initialization to FALSE happens at program startup time
(actually, at compile time, i believe).  This code basically means, by default
we have not been here; the first time we run through it, we will set the flag,
and on all subsequent invocations we will bail out early.

muppet <scott at asofyet dot org>

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]