RE: Fixing -pthreads (Re: ports and -current)

From: David Schwartz <davids_at_webmaster.com>
Date: Thu, 25 Sep 2003 19:33:06 -0700
David Xu wrote:

> I definitly agree with Dan, -pthread is too ugly, it really really is
> nothing to do with compiler and should be removed.

	Really? What if invoking the threading library required the compiler to
compile code differently? Surely it might require that on some platforms,
say certain optimizations weren't thread safe. You're looking at this from
the FreeBSD perspective rather than the GCC perspective.

> If someone
> thinks -pthread
> should be kept, then think about Microsoft, you are doing
> Microsoft way and
> cause lots of trouble when I am programmming on Windows,
> Microsoft has two
> version of c library, threaded library and non-threaded library,
> it need a
> compiler flag -MT to link a thread library, then lots of library conflict
> with this flag at linking time because some were compiled with
> -MT some were
> not, this is rather annoying. This is a bit OT, but I hope we can
> avoid such decision bug.

	You can't avoid this. Suppose that some optimizations have to be disabled
to make code thread safe and say these optimizations are significant. Then
what would you do? Compile all code with the optimizations disabled and lose
performance for all the apps that aren't threaded? You can't change the fact
that threaded code and non-threaded code are incompatible on some platforms.

> Many software use autoconf, autconf prefers -lpthread than
> -pthread, it even prefers -lc_r then -pthread (if I remembered it right ).

	And then autconf breaks when what you need to do to make pthreads works
changes. What happens if the next threading library requires compiler flags?
Or generates incompatible object code?

> if system has a libpthread there, it will generate Makefile to
> use -lpthread
> not -pthread, obviously -pthread is not suggested to use.

	Not suggested by whom? The whole point of '-pthread' was to have a way to
say, "I want to use this standard". If '-pthread' is wrong, so is '-ansi'.
So is '-std=<whatever>'.

> One word, just let -pthread die.

	Only if you thing standards are a bad thing.

	I'm sorry, I told myself I'd stay out of this now. I really appreciate the
concern being shown and the direction that things are going. However, I
think '-pthread' is a good thing. It's nice to have a portable way to say
that I want to compile POSIX code. What good is a standard if there's no
standard way to get to it?

	DS
Received on Thu Sep 25 2003 - 17:33:09 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:23 UTC