This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] Thread support for TPF
- From: Ulrich Weigand <weigand at i1 dot informatik dot uni-erlangen dot de>
- To: zack at codesourcery dot com (Zack Weinberg)
- Cc: weigand at i1 dot informatik dot uni-erlangen dot de (Ulrich Weigand), gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org, darcypj at us dot ibm dot com
- Date: Wed, 22 Sep 2004 19:24:48 +0200 (CEST)
- Subject: Re: [PATCH] Thread support for TPF
Zack Weinberg wrote:
> Ulrich Weigand <weigand@i1.informatik.uni-erlangen.de> writes:
>
> > + static inline int
> > + __gthread_active_p (void)
> > + {
> > + return 1;
> > + }
> > +
> > + static inline int
> > + __gthread_once (__gthread_once_t *once, void (*func) (void))
> > + {
> > + if (__tpf_pthread_active ())
> > + return pthread_once (once, func);
> > + else
> > + return -1;
> > + }
>
> Why this instead of mapping __gthread_active_p to
> __tpf_pthread_active?
Because __gthread_active_p is currently understood by libstdc++
to never change during execution of a program, and mean something
like 'the current program might become multi-threaded at any
point during future execution' (which is always true on TPF).
See e.g.
namespace __gnu_cxx
{
namespace {
#if defined __GTHREADS
bool const __threads_enabled = __gthread_active_p();
#endif
}
in include/ext/bitmap_allocator.h ...
Bye,
Ulrich
--
Dr. Ulrich Weigand
weigand@informatik.uni-erlangen.de