gthread once



Dear All,

To the bug 69688 I have attached (attachment id 6767) a patch with fast
implementation of g_thread_once(). I is implementad in terms of already
present gthread abstraction. I does not block the whole system while running
the once handler but only all threads waiting on the particular once guard.

the test case thread-test has been extended to run the once test also.

Could you review the fix and apply if appropriate?

Regards.


Usage
...
GThreadOnce myonceguard = G_THREAD_ONCE_INIT;

...
void myoncefunc (void)
{
	do some initialization
}

...
void f (void)
{
	...
	g_thread_once (myonceguard, &myoncefunc);
	...
}

the function myoncefunc will be executed only once independent of the number
of g_thread_once (myonceguard, &myoncefunc) calls.
-- 
Miroslaw Dobrzanski-Neumann

MOSAIC SOFTWARE AG
Base Development and Research
Tel +49-2225-882-291
Fax +49-2225-882-201
E-mail: mne mosaic-ag com




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