This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libstdc++, how to set gcc on a multithread environment ?


2009/7/27 Jose Luis Marchetti:
>
> I would like to safely run a multithread application that uses the libstdc++. -pthread option when invoking gcc is the only option I need to add ? Do I need this option at compiler time ?

Yes, at compile time *and* link time.
> Exactly, also not clear for me as well.

The semantics of -pthread are perfectly clear to me, it was your
question I didn't understand :-)

>> Depending on the platform, the -pthread option might affect
>> the
>> preprocessor, e.g. defining _REENTRANT, and that can affect
>> the C
>> library, and other libraries, so using -pthread can affect
>> many
>> things.
>>
>
> When you say "defining _REENTRANT", that does not mean anything to me, I am a compiler user. As this subject is not clear for me, I would like to know ( or at least have some examples ) where the -pthread option makes difference.

I mean it has the effect of #define _REENTRANT, or using -D_REENTRANT
on the command line.  Where that makes a difference depends on your
platform and the libraries you're using.  If you don't understand the
details, just do what the docs say and use -pthread when compiling and
linking.

Jonathan


>
>> Jonathan
>>
>
>
>      ____________________________________________________________________________________
> Veja quais são os assuntos do momento no Yahoo! +Buscados
> http://br.maisbuscados.yahoo.com
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]