This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: -pthread


Magnus Fromreide <magfr@lysator.liu.se> writes:

> I recently ended up in a discussion about the -pthread flag at work and
> when looking at the documentation I noticed that it is defined onlt for
> SPARC and RS/6000/PowerPC.
>
> Additionally -fopenmp and -ftree-parallelize-loops say they are only
> supported on targets where -pthread are available.
>
> Now, on x86-linux it seems as if -pthread does something but there is no
> documentation of it so I'd like to know
>
>       * What does -pthread do on x86?

On x86 GNU/Linux -pthread defines _REENTRANT for the preprocessor and
links against -lpthread.

>       * If I am to compile a threaded program am I then requiered to use
>         -pthread?

On GNU/Linux, you need to use -pthread or -D_REENTRANT at compilation
time, and you need to use -pthread or -lpthread at link time.

I agree that this really ought to be documented.

Ian


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