threading in FreeBSD (acx_pthreads)

Daniel Eischen deischen at
Mon Feb 4 09:13:57 PST 2008

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

> Daniel Eischen <deischen at> writes:
>> Dag-Erling Smørgrav <des at> writes:
>>> Daniel Eischen <deischen at> 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.
> Sure it does, in the specification for the C compiler command.
>>> 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.
> Which completely dodges my point about the man pages.

Our man pages need to be updated.

> And no matter how grand acx_pthreads is, it won't DTRT on FreeBSD
> versions that have libkse as the default thread library.

It depends on your point of view, but regardless it can be
overridden with PTHREAD_LIBS to whatever thread library you
want.  If it were ever imported into our ports system, it
would have to be patched to obey PTHREAD_LIBS, so why not
make it play nice?


More information about the freebsd-threads mailing list