TR library extensions

Martin Sebor sebor@roguewave.com
Tue Oct 7 01:42:00 GMT 2003


Gabriel Dos Reis wrote:

...
> | I've been using gcc -threads and gcc -pthreads with the same compiler
> | on Solaris (at least with 2.95.2), so unless that's changed I think
> | you're mistaken (or we're talking about different things).
> 
> You've been using something not guaranteed.  The (GCC-3.x) doc says:

Are you saying this because you *know* that it may cause problems
or are you just getting from the blurb below? I can't find much on
threading options in the manual but I don't see where it says that
using two different threading options (such as -threads or -pthreads
on Solaris) with the same compiler isn't "guaranteed" to work. It has
worked for years with 2.95.2 and seems to work just fine with 3.3.
 From briefly looking at the gcc sources I don't see why switching
between these two modes on SunOS would cause any trouble (all it
seems to do is switch between -lthreads and -lpthreads on the link
line, and since -lpthreads implies -threads on which the gthreads
wrapper is based there shouldn't be any issue).

> 
>    --[ invoke.texi ]--
>    @item -threads
>    @opindex threads
>    Add support for multithreading with the @dfn{dce thread} library
>    under HP-UX.  This option sets flags for both the preprocessor and
>    linker.
> 
>    --[ install.texi ]--
>    @item --enable-threads
>    Specify that the target
>    supports threads.  This affects the Objective-C compiler and runtime
>    library, and exception handling for other languages like C++ and Java.
>    On some systems, this is the default.
> 
>    In general, the best (and, in many cases, the only known) threading
>    model available will be configured for use.  Beware that on some
>    systems, gcc has not been taught what threading models are generally
>    available for the system.  In this case, @option{--enable-threads} is
>    an
>    alias for @option{--enable-threads=single}.
> 
> The docs do not say you can change between thread model with the same
> compiler.  

No, but it doesn't say I can't either. I sincerely hope you're wrong
about this because there is a lot of code out there that uses these
two options on Solaris with the same compiler.

Martin




More information about the Libstdc++ mailing list