[PATCH] Thread support for TPF

Ulrich Weigand weigand@i1.informatik.uni-erlangen.de
Wed Sep 22 17:24:00 GMT 2004


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



More information about the Libstdc++ mailing list