From owner-freebsd-hackers Wed Jan 10 21: 0:38 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from pcnet1.pcnet.com (pcnet1.pcnet.com [204.213.232.3]) by hub.freebsd.org (Postfix) with ESMTP id 90B3237B401 for ; Wed, 10 Jan 2001 21:00:21 -0800 (PST) Received: (from eischen@localhost) by pcnet1.pcnet.com (8.8.7/PCNet) id XAA26798; Wed, 10 Jan 2001 23:59:57 -0500 (EST) Date: Wed, 10 Jan 2001 23:59:57 -0500 (EST) From: Daniel Eischen To: Peter Haight Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: pthread_attr_setschedparam, mozilla, and PTHREAD_MAX_PRIORITY In-Reply-To: <200101110441.f0B4fe008116@wartch.sapros.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Wed, 10 Jan 2001, Peter Haight wrote: > I rebuilt mozilla after upgrading to 4.2 and was getting an assertion > because pthread_attr_setschedparam() was failing with a ENOTSUP. It turns > out Mozilla was trying to set the thread priority to 42 which is above the > new limit of 31 which changed a little before 4.2-RELEASE. > > To patch mozilla I had to do a '#if __FreeBSD_version >= 420000' because > PTHREAD_MAX_PRIORITY is in a private pthreads header file. I'm wondering if > it might not be a good idea to have that define show up somewhere public? > The only other thing I can think of is to call pthread_attr_setschedparam() > a couple of times to scope out the range of accepted values. As far as I read the POSIX spec, this is not exported. I'll have a look at it again when I get the chance. That said, POSIX only guarantees priorities in the range 0-31 (which is what we now allow). The exception is for SCHED_OTHER which can be implementation defined. Either way you look at it, it seems that a properly coded threaded application ought to rely on priorities in the range 0-31 (for non-SCHED_OTHER), or should scope them out at run-time. -- Dan Eischen To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message