threading in FreeBSD (acx_pthreads)

Daniel Eischen deischen at freebsd.org
Mon Feb 4 09:02:14 PST 2008


On Mon, 4 Feb 2008, Dag-Erling Smørgrav wrote:

> Daniel Eischen <deischen at freebsd.org> writes:
>> No, do not use -lpthread.  Refer to John Baldwin's response, -pthread is
>> what you should be using.
>
> That is not what POSIX says.

As far as I know, POSIX doesn't say how you link to a threads library.

> That is not what our own man pages say, either.

Our ports system uses -pthread as the default, and we've been pushed
this way because GNU has set it as some form of standard.  All the
macros out there seem to expect this as well.

> In my recollection, it's not even what the people who started our
> transition away from libc_r said (though it waffled back and forth for a
> bit, so I may misremember).

Yes, I was one of them and was against -pthread, but have been
assimilated.

> More importantly, it makes *absolutely no difference* to the finished
> code.

It does if you are on 4.x and don't have -lpthread, but regardless,
-pthread is what our ports system uses as the default and we are
talking about 3rd party software.  It really should play nice with
our ports system and the m4 macro does seem to obey PTHREAD_LIBS
and PTHREAD_CFLAGS.

-- 
DE


More information about the freebsd-threads mailing list