From owner-freebsd-hackers Fri Apr 9 4:21:14 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from smtp2.vnet.net (smtp2.vnet.net [166.82.1.32]) by hub.freebsd.org (Postfix) with ESMTP id 2F2F414F9B for ; Fri, 9 Apr 1999 04:21:11 -0700 (PDT) (envelope-from rivers@dignus.com) Received: from dignus.com (ponds.vnet.net [166.82.177.48]) by smtp2.vnet.net (8.9.1a/8.9.1) with ESMTP id HAA20915; Fri, 9 Apr 1999 07:20:35 -0400 (EDT) Received: from lakes.dignus.com (lakes.dignus.com [10.0.0.3]) by dignus.com (8.9.2/8.8.5) with ESMTP id HAA18202; Fri, 9 Apr 1999 07:19:04 -0400 (EDT) Received: (from rivers@localhost) by lakes.dignus.com (8.9.2/8.6.9) id HAA31810; Fri, 9 Apr 1999 07:19:03 -0400 (EDT) Date: Fri, 9 Apr 1999 07:19:03 -0400 (EDT) From: Thomas David Rivers Message-Id: <199904091119.HAA31810@lakes.dignus.com> To: dick@tar.com, hackers@FreeBSD.ORG, roger@cs.strath.ac.uk Subject: Re: cc -pthread and -kthread switches In-Reply-To: <370DC114.E0A81FDE@cs.strath.ac.uk> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > 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