gnu.gcc.help
[Top] [All Lists]

Re: pthread

Subject: Re: pthread
From: Paul Pluzhnikov
Date: Tue, 18 Jul 2006 16:06:30 -0700
Newsgroups: gnu.gcc.help
skaller <skaller@xxxxxxxxxxxx> writes:

> Hi, the gcc manual says certain processor/os combinations have
> flags -pthreads and -pthread. I have the vague idea these are
> unnecessary, can someone confirm that?

If you are not developing multi-threaded code, then
-pthread/-pthreads are not needed. If you do, they are very much
necessary.

> Manual says it just sets define in preprocessor and linker switches.

Here is what "info gcc" says:

`-pthread'
     Adds support for multithreading with the "pthreads" library.  This
     option sets flags for both the preprocessor and linker.

> -lpthread (and possibly -lrt) also set linker switches. 

These aren't linker switches (at least not in the usual sense).
They are directions to the linker to search for and link against
libpthread.{so,sl,a} and librt.{so,sl,a} libraries.

> If the preprocessor symbol doesn't affect code generation,

What made you think it doesn't?

On many platforms, the *source* that the compiler sees changes
depending on whether -pthread{s} is on the link line or not.
And changing source often causes generated code to be quite different
as well.

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.

<Prev in Thread] Current Thread [Next in Thread>
  • pthread, skaller
    • Re: pthread, Paul Pluzhnikov <=
Privacy Policy