[PATCH] posix gthreads additions for c++0x thread library

Chris Fairles chris.fairles@gmail.com
Mon Aug 18 20:55:00 GMT 2008


So just focusing on posix platform in these patches.

gthr-posix-patch.txt includes the necessary changes to gthr-posix.h
and gthr-posix.c. I moved some of the objc-only definitions so they
are no longer objc-only (to avoid dup defs). The objc folk will have
to take a look at this to make sure its ok
(--enable-languages=c,c++,objc on x86_64 bootstraps fine for what its
worth).

The second patch is the libstdc++-v3 configury bits that basically
tests for the required __gthread*_t types and functions using
AC_TRY_LINK. This was slightly difficult because gthr-default hasn't
been set up yet so I had to add -D_PTHREADS to CXXFLAGS (conditionally
on posix thread model) so that gthr.h picks gthr-posix.h and I also
had to add -DSUPPORTS_WEAK -DGTHREAD_USE_WEAK so that it linked (not
100% sure why however). I thought adding -pthreads to CXXFLAGS or
LDFLAGS would pull in the posix library for linking (if available) but
it didn't work.

If AC_TRY_LINK succeeds, _GLIBCXX_HAS_GTHREADS is defined and the
C++0x headers (<thread>, <mutex> and <condition_variable>) can use it
to conditionally provide support for the thread library (similar to
_GLIBCXX_USE_C99_STDINT_TR1)

Chris
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gthr-posix-patch.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080818/6ed33219/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gthr-v3-configury-bits.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080818/6ed33219/attachment-0001.txt>


More information about the Gcc-patches mailing list