Re: gthread once



Hi Miroslaw,

> What about the followin solution:
> let GOnce contain all information needed.
> 
> GOnce contains all values needed as
> 
> struct GThreadOnce
> {
> 	sig_atomic_t once;
> 	GThreadOnceFunction init_func;
> 	gpointer param;
> 	gpointer retval;
> }
> 
> g_thread_once* () takes only one parameter, the once control block and returns
> the result of evaluation

I thought about that too, but writing those params into g_once makes the
code more readable. 

Another problem, that I just noticed is, that we can't use GOnce for
g_static_mutex_get_mutex_impl, because that would we a chicken/egg
problem, but we can use the same technique and the same configure.in
tests.

Bye,
Sebastian
-- 
Sebastian Wilhelmi
mailto:wilhelmi ira uka de
http://goethe.ira.uka.de/~wilhelmi





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