Bug with pthread_getspecific() and signals

Craig Rodrigues rodrigc at crodrigues.org
Fri Apr 22 08:02:07 PDT 2005


On Mon, Apr 18, 2005 at 03:05:28PM -0500, Archie Cobbs wrote:
> So perhaps the simplest thing to do is look for libpthread and always
> link "-lpthread"; otherwise, if libpthread is not found, bail out.

That's a reasonable approach.

Alternatively, if you want, look at the devel/apr port (which I
maintain).  I had to put some logic in there in the configure scripts
to link to the correct pthread library, depending if you
are on 4.x or 5.x.

Basically, what I have logic that does something like:

        os_version=`/sbin/sysctl -n kern.osreldate`
        # 502102 is when libc_r switched to libpthread (aka libkse).
        if test $os_version -ge "502102"; then
          apr_cv_pthreads_cflags="none"
          apr_cv_pthreads_lib="-lpthread"
        else
          APR_ADDTO(CPPFLAGS, [-D_THREAD_SAFE -D_REENTRANT])
          apr_cv_pthreads_lib="-lc_r"
          APR_SETIFNULL(enable_threads, [no])
        fi


In my opinion, when libc_r is removed from the tree in -CURRENT, that will
be good, because people still try to use it, and then
get annoyed when they encounter problems with it.
It can't disappear in the 4.x branch though....

-- 
Craig Rodrigues        
rodrigc at crodrigues.org


More information about the freebsd-threads mailing list