[PATCH] Threadsafe locale initialization
Pétur Runólfsson
peturr02@ru.is
Thu Oct 2 16:45:00 GMT 2003
Benjamin Kosnik wrote:
> From gthr.h, it looks like __gthread_active_p always returns true if
> __GTHREADS. Maybe I'm wrong?
This is from gthr-posix.h (gthr-solaris.h seems similar):
#define __GTHREADS 1
[...]
#include <pthread.h>
[...]
#if SUPPORTS_WEAK && GTHREAD_USE_WEAK
#pragma weak pthread_once
[...]
#pragma weak pthread_create
[...]
static inline int
__gthread_active_p (void)
{
static void *const __gthread_active_ptr = (void *) &pthread_create;
return __gthread_active_ptr != 0;
}
#else /* not SUPPORTS_WEAK */
static inline int
__gthread_active_p (void)
{
return 1;
}
#endif /* SUPPORTS_WEAK */
So it seems that __gthread_active_p() can return 0 under some
conditions (although I'm not quite sure which).
> 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.
I agree, except that __gthread_mutex_[un]lock must be wrapped in
an exception safe lock class.
Petur
More information about the Libstdc++
mailing list