[Gc] threads under android

Boehm, Hans hans.boehm at hp.com
Tue Jan 12 11:42:45 PST 2010

This may all be as it should be, but I'm not an Android expert.

Gcc defaults to single-threaded behavior.  (Seems a bit dubious to me, but ...)  My impression is that "single" mostly means that some C++ template libraries aren't thread-safe by default.  I think gcc's code generation is otherwise fairly independent of the threading model.  (Which is part feature, and arguably part bug.)

Since gcc defaults to thread-unsafe behavior, I think the collector should as well.  This is easy enough to override if you want to use the provided pthreads implementation, except that I'm not sure about the state of pthread-on-Android support in the collector.

In any case, I don't see an argument for gcc and GC having different defaults with respect to thread support, even if thread support exists and gcc doesn't use it by default.  In that case, it's likely that some of the default libraries will also not be thread-safe (since they were probably compiled with the default gcc and hence a thread-unsafe C++ library).  Why should the GC be any different?  If you need threads on such a platform, I think you need to make sure you're using specially-compiled thread-safe libraries.


> -----Original Message-----
> From: gc-bounces at napali.hpl.hp.com 
> [mailto:gc-bounces at napali.hpl.hp.com] On Behalf Of 
> Marcos_David.Dione at sophia.inria.fr
> Sent: Tuesday, January 12, 2010 9:27 AM
> To: gc at napali.hpl.hp.com
> Subject: [Gc] threads under android
>   gc's configure.ac file has this code for testing for threads:
> AC_ARG_ENABLE(threads,
>   [AC_HELP_STRING([--enable-threads=TYPE], [choose threading 
> package])],
>   THREADS=$enableval,
>   [ AC_MSG_CHECKING([for thread model used by GCC])
>     THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
>     if test -z "$THREADS"; then
>       THREADS=no
>     fi
>   thing is, android's toolchain answers 'single', but then 
> they implement a good part of pthreads in bionic. so the 
> question is: what does this 'single' mean, that the tools 
> cannot generate a threading binary? if not, wouldn't the test 
> be wrong? I'm completely clueless about this and I can't seem 
> to find relevant info. does anyone know?
> --
> Lic. Marcos Dione
> Engineer Expert - Hop Project
> https://hop.inria.fr/
> INRIA Sophia Antipolis - Méditerranée
> Phone: +33 (0)4 92 38 79 67
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com
> https://www.hpl.hp.com/hosted/linux/mail-archives/gc/

More information about the Gc mailing list