Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Nov 2002 13:07:16 -0500 (EST)
From:      Daniel Eischen <eischen@pcnet1.pcnet.com>
To:        Doug Rabson <dfr@nlsystems.com>
Cc:        arch@FreeBSD.ORG
Subject:   Re: What to do with userland *context() functions
Message-ID:  <Pine.GSO.4.10.10211161258320.20425-100000@pcnet1.pcnet.com>
In-Reply-To: <200211161649.50346.dfr@nlsystems.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10211161258320.20425-100000>