Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Apr 1999 17:45:07 -0500
From:      "Richard Seaman, Jr." <dick@tar.com>
To:        "Kurt D. Zeilenga" <Kurt@OpenLDAP.Org>
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: compiler specs for -pthread/-kthread
Message-ID:  <19990413174507.A440@tar.com>
In-Reply-To: <3.0.5.32.19990413151601.009b2100@localhost>; from Kurt D. Zeilenga on Tue, Apr 13, 1999 at 03:16:01PM -0700
References:  <3.0.5.32.19990413151601.009b2100@localhost>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Apr 13, 1999 at 03:16:01PM -0700, Kurt D. Zeilenga wrote:
> To facilate auto detection of the local threading environment,
> it would be nice if the -?thread options set all the necessary
> compiler/linker flags.  It is a common practace for such
> options to specify both compilation and link options.
> 
> I suggest the EGCS specs be adjusted to:
> 
> -pthread => -D_THREAD_SAFE -D_UTHREADS -lc_r
> -kthread => -D_THREAD_SAFE -D_KTHREADS -lpthread

A little known and not well documented fact is that FreeBSD also
uses _REENTRANT in its header files.  Ever wondered why you 
couldn't find declarations for gamma_r, lgamma_r, gammaf_r,
or lgammaf_r?  Check math.h.  :) 

Personally I think conditional declarations should just be
eliminated from math.h, rather than tell people they might
have to add -D_REENTRANT. :) 

> 
> If the LinuxThread "port" is targetted to be -kthread:
> 
> -kthread => -D_REENRANT -D_LINUXTHREADS -lpthread

In FreeBSD, you should define -D_THREAD_SAFE for linuxthreads if
you want the thread safe behaviour in stdio.h.  Its a libc thing,
not a linuxthreads thing.  Adding -D_REENTRANT to linuxthreads 
doesn't get you anything except the added headers in math.h (same
as libc_r).

> After modify the specification, the headers/libraries would
> be adjusted as needed.  I can easily submit diffs if desirable.

Nobody has offered to commit the changes to the header files I
have requested, and the PR I submitted on Jan 29 has not been
acted upon.  As a result, I anticipate dropping the -DLINUXTHREADS
solution to the header conflict problem in favor of stuffing
all the linux threads specific headers into
  /usr/local/include/pthread/linuxthreads
where they go now, and instead of -DLINUXTHREADS, people will
have to add -I/usr/local/include/pthread/linuxthreads to
their compile options.  (This works now too).

-- 
Richard Seaman, Jr.           email: dick@tar.com
5182 N. Maple Lane            phone: 414-367-5450
Chenequa WI 53058             fax:   414-367-5852


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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