From owner-freebsd-arch Sat Nov 16 10: 7:23 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A341837B401 for ; Sat, 16 Nov 2002 10:07:22 -0800 (PST) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3135A43E3B for ; Sat, 16 Nov 2002 10:07:22 -0800 (PST) (envelope-from eischen@pcnet1.pcnet.com) Received: from localhost (eischen@localhost) by mail.pcnet.com (8.12.3/8.12.1) with ESMTP id gAGI7Gaw023543; Sat, 16 Nov 2002 13:07:16 -0500 (EST) Date: Sat, 16 Nov 2002 13:07:16 -0500 (EST) From: Daniel Eischen To: Doug Rabson Cc: arch@FreeBSD.ORG Subject: Re: What to do with userland *context() functions In-Reply-To: <200211161649.50346.dfr@nlsystems.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, 16 Nov 2002, Doug Rabson wrote: > On Saturday 16 November 2002 3:26 pm, Daniel Eischen wrote: > > After adding *context() as system calls, we no longer > > need the userland versions. But I would like to use > > them in libc_r and they might be useful to someone else > > writing their own userland threading library. As of > > now, we need different variants of them for libpthread, > > so they aren't expected to be used there. > > > > How do folks feel about keeping them in libc, but named > > as _getctx, _setctx, _swapctx? They would be similar > > to _setjmp/_longjmp which don't save/restore the signal > > mask. It'll add a little bloat to libc and they are > > only present for i386 and alpha archs. > > > > I'll have them repo-copied to libc_r if the consensus is > > to remove them from libc. > > I'm not quite sure why libc_r can't use the standard swapcontext system > call. Is it something to do with the signal mask? It seems to defeat > the object to create a bunch of nice standard functions for low-level > thread switching and then not use them. Plus it means we need to > maintain two (or three) variations of the same code, which seems wrong. The threads libraries don't need to save/restore the process signal mask, so using userland versions of *context() optimizes thread switches. Libpthread already has its own set of userland context switching and libc_r is using _setjmp/_longjmp. For archs without userland *context() functions of some sort, we'll use the system calls. -- Dan Eischen To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message