[Gc] threads under android

Boehm, Hans hans.boehm at hp.com
Tue Jan 12 15:39:52 PST 2010

> From: Marcos_David.Dione at sophia.inria.fr 
> On Tue, January 12, 2010 8:42 pm, Boehm, Hans wrote:
> > 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.
>   but all this applies to c++, or so it seems from your 
> description. what impact it would have on a all C project 
> like bigloo and hop?
That seems to depend on two questions I don't know the answer to:

- Whether the "single" threaded gcc configuration implies that C code is also less thread-safe, e.g. because C header files are also sensitive to it.

- Whether those projects rely on (e.g. GUI) libraries that are internally implemented in C++, and which could as a result break in multi-threaded applications.


More information about the Gc mailing list