Thread model: simple and C

2010-08-04 Thread Marcos Dione

first of all: I'm not subscribed to gcc's ML, so please cc: in any answers.

I'm cross-compiling an application to a platform whose SDK brings a gcc 
which reports 'Thread model: single'. even so, the platform implements a 
rudimentary thread support (a subset of posix), which leads me to think 
that it should be possible to use it in C programs.

why? because the only reference to Thread model I could find in gcc's 
doc is in libstdc++'s manual[1] and no other useful reference about simple 
thread model.

in particular, my main concern is not about our own program but a library 
we use, namely, Boehm's GC, which I see is included in gcc's code. I already 
asked Boehm itself (via the GC's ML[2]) but he's not sure what are the 
implications.

so, in short: does a simple Thread model have any impact on C-only 
programs that could use threads? in particular, how it does impact 
Boehm's GC usage in a C-only program? if the impact is negative, would 
you say that the original gcc is compiled with the wrong flags, given that 
there is a bit of pthreads implementation in the platform?

--
[1] http://gcc.gnu.org/onlinedocs/libstdc++/manual/using_concurrency.html

[2] 
http://comments.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/3680
-- 
Lic. Marcos Dione
Engineer Expert - Hop Project
http://hop.inria.fr/
INRIA Sophia Antipolis - Méditerranée
Phone: +33 (0)4 92 38 79 67


Re: Thread model: single and C programs

2010-08-05 Thread Marcos Dione
On Thursday 05 August 2010 10:33:11 Jonathan Wakely wrote:
> On 5 August 2010 04:54,   wrote:
> >so it is wrong that some projects (in particular, Boehm's GC) test
> > thread availability by looking at the output of 'gcc -v' because that
> > would be assuming that it will use the same libraries compiled along
> > with that gcc?
> 
> I don't know that it's "wrong," it might just be a requirement of
> using that project that you use suitable runtime libraries that match
> the compiler used to build the project.  It's not up to GCC to decide
> other projects' requirements.

you're right, I was asking in the general sense. from the rest of the mail 
it seems that a check like that is meaningful only if you're going to use any 
of the libraries that comes with gcc (which is not my case). now, is it 
possible that if a project does not use libstdc++ or any other library that 
comes with gcc still be affected by the thread model? for example, does it 
affect the C code produced? you only mentioned that it doesn't affect on the 
usage of threads.

> > also, you don't mention libc at all. is it different
> 
> I have no idea, that's something you'd have to ask the libc
> maintainers, not the GCC list.

ah, sorry, the fact that libstdc++ is part of gcc got me to think that 
glibc was also, but didn't check.

> The library is called libstdc++

yes, sorry, that's what happens when you answer technical mails (or 
otherwise) at 5AM.

> Additionally, features of the library which require thread-related
> components such as mutexes will be disabed and unavailable if GCC was
> configured without a supported thread model.

just to be sure, you're still talking about libstdc++?

-- 
Lic. Marcos Dione
Engineer Expert - Hop Project
http://hop.inria.fr/
INRIA Sophia Antipolis - Méditerranée
Phone: +33 (0)4 92 38 79 67