This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] Threadsafe locale initialization
- From: Benjamin Kosnik <bkoz at redhat dot com>
- To: Pétur Runólfsson <peturr02 at ru dot is>
- Cc: libstdc++ at gcc dot gnu dot org, ljrittle at acm dot org
- Date: Thu, 2 Oct 2003 11:15:09 -0500
- Subject: Re: [PATCH] Threadsafe locale initialization
- Organization: Red Hat / Chicago
- References: <07D05A69A3D0C14FAEA60C3ACE8E5564028F55D7@mail.ru.is>
>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