Subj : Re: double-checked locking in C To : comp.programming.threads From : Laurent Deniau Date : Thu Jul 07 2005 05:17 pm Alexander Terekhov wrote: > Laurent Deniau wrote: > [...] > >>pthread_once (fast) > > > It (currently) doesn't work in the dynamic context. What do you mean by "dynamic context"? Do you mean that the following code does not work? static struct singleton *singleton = 0; static void make_singleton(void) { singleton = malloc(sizeof(*singleton)); // ... } void* get_singleton(void) { static pthread_once_t once = PTHREAD_ONCE_INIT; pthread_once(&once, make_singleton); return singleton; } >>Do you know portable (C+POSIX) alternatives? > > > DCSI-TLS/TSD. > > http://groups.google.de/group/comp.programming.threads/msg/83510c51ea86e1d0 Thanks, I will read the thread. ld. .