Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Feb 2008 14:56:30 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-threads@freebsd.org
Cc:        "Karl H. Beckers" <karl.h.beckers@gmx.net>, Daniel Eischen <deischen@freebsd.org>, Dag-Erling =?iso-8859-1?q?Sm=C3=B8rgrav?= <des@des.no>
Subject:   Re: threading in FreeBSD (acx_pthreads)
Message-ID:  <200802041456.30785.jhb@freebsd.org>
In-Reply-To: <58004.192.9.112.196.1202145786.squirrel@www.our-isp.org>
References:  <5913.192.9.112.196.1202124683.squirrel@www.our-isp.org> <Pine.GSO.4.64.0802041157030.13899@sea.ntplx.net> <58004.192.9.112.196.1202145786.squirrel@www.our-isp.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Monday 04 February 2008 12:23:06 pm Karl H. Beckers wrote:
> whoa,
> 
> slowly please, you're loosing me. So, there is:
> 
> -lthr
> -pthread
> -lpthread
> -lc_r
> lthread
> -kthread
> 
> I've read one opinion (a) saying I should use:
> -lthr -lpthread -lc_r (because -pthread might not be safe on all versions)
> 
> the autoconf module (b) does:
> -kthread lthread -pthread (now what's -kthread and lthread and how do they
> relate to -lthr or -lc_r)
> 
> And the other opinion (c) I heard was:
> -pthread -lc_r (and leave anything else to the user and PTHREAD_LIBS)
> 
> And I take it that (c) is what your ports system is doing and the
> discussion is around whether that's the right thing to do?

Just -pthread, no -lc_r.  On 4.x -pthread expands to -D_REENTRANT -lc_r (or 
something like that).  On 5.x+ -pthread expands to -lpthread.  IOW, -pthread 
always expands to the appropriate system default.  If you want to use libthr 
on 6.x then you can either explicitly say -lthr instead of -pthread or rename 
libpthread to libkse and symlink libpthread to libthr.  (Or use libmap.conf 
to map libpthread to libthr, etc.).

Also, FWIW DES, at work when folks did benchmarks for Java stuff on 6.x, 
libkse had better performance than libthr.  Granted, Java is a bit more of an 
odd benchmark b/c it is thread happy and thus more suited to a M:N model than 
most other threading workloads.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802041456.30785.jhb>