Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Apr 1999 07:19:03 -0400 (EDT)
From:      Thomas David Rivers <rivers@dignus.com>
To:        dick@tar.com, hackers@FreeBSD.ORG, roger@cs.strath.ac.uk
Subject:   Re: cc -pthread and -kthread switches
Message-ID:  <199904091119.HAA31810@lakes.dignus.com>
In-Reply-To: <370DC114.E0A81FDE@cs.strath.ac.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> Hi,
> 
> What do you think to a new switch for cc?
> 
> cc has the extra compiler options -pthread and -kthread which invoke
> the userland pthreads or the kernel threads respectivly.
> 
> How easy would it be to change this to
> cc -pthread   *New meaning*. It invokes either -uthread or -kthread,
> depending on a
>               envoronment variable or a setting in a config file (eg
> /etc/thread_type)
> 
> cc -uthread   use useland threads (what is currently -pthread)
> cc -kthread   use kernel threads
> 

 In general, having _external_ influences on options (e.g. an environment
variable) is not a good idea, IMHO.

 The problem is the build works fine for you, then someone else runs
what he thinks is the *exact same build*  and it doesn't work...
The answer is:  "Oh yeah, did you check XXXX, or YYYY, and some other
thingy I set on my system last year but forgot about."   I've "been there,
done that" - it doesn't work out well in the long run.

 If you would like to change your own build environment/makefile, you could
do something like:

	PTHREAD=-pthread
		-or-
	PTHREAD=-kthread
then
	cc $PTHREAD ....

then, you would be setting your own environment variable... that's easy
to do without changing cc.  Or, you could do something like:

	PTHREAD=`cat etc/thread_type`
	  ...
	cc $PTHREAD ...

which implements your second example.

 Why is this better?  There's no "hidden" magic here... it's obvious
in either case that the environment variable PTHREAD matters to the
build.

	- Just my thoughts -
	  - Dave Rivers -



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




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