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]

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


Hi,

After reading gcc documentation and this link:http://gcc.gnu.org/onlinedocs/libstdc++/manual/using_concurrency.html, I am not sure of:

1) Only adding -pthread option when invoking gcc suffices ?
Here is what gcc documentation says:
-pthread Add support for multithreading using the POSIX threads library. This option
sets flags for both the preprocessor and linker. It does not affect the thread
safety of object code produced by the compiler or that of libraries supplied with
it.


2) I have already added the pthread lib on my link, but it looks like I also need to add the -pthread option to the compiler.

3) The link I showed above says:
"Allocators called while a container or element is constructed uses an internal lock obtained and released solely within libstdc++ code (in fact, this is the reason STL requires any knowledge of the thread configuration)."

So this is the reason we need to use the -pthread option when invoking gcc ? Any other reason ?

Thanks in advance!
José Luís Marchetti


      ____________________________________________________________________________________
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]