[PATCH] Threadsafe locale initialization

Benjamin Kosnik bkoz@redhat.com
Thu Oct 2 16:15:00 GMT 2003


>I copied the __gthread_active_p() check from __mt_alloc::allocate
>(in include/ext/mt_allocator.h). The implementation of
>__gthread_once in gthr-posix.h is:
>
>static inline int
>__gthread_once (__gthread_once_t *once, void (*func) (void))
>{
>  if (__gthread_active_p ())
>    return pthread_once (once, func);
>  else
>    return -1;
>} 
>
>so it seems that _S_initialize_once() must be called manually if
>__GTHREADS is defined but __gthread_active_p() returns false.
>Am I missing something obvious here?

>From gthr.h, it looks like __gthread_active_p always returns true if
__GTHREADS. Maybe I'm wrong?

Anyway.

I'd really like bits/stl_threads.h to be killed entirely, and code
including it to be changed to use bits/gthr.h. 

-benjamin



More information about the Libstdc++ mailing list