Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 24 Jun 2014 09:17:09 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Cc: Justin Cormack <justin@...cialbusservice.com>
Subject: Re: getcontext etc was Re: Re: go support (was: Best
 place to discuss other lightweight libraries?)

On Tue, Jun 24, 2014 at 01:12:44PM +0300, Timo Teras wrote:
> On Tue, 24 Jun 2014 11:05:01 +0100
> Justin Cormack <justin@...cialbusservice.com> wrote:
> 
> > On Jun 23, 2014 11:32 PM, "Rich Felker" <dalias@...c.org> wrote:
> > > > Just to revive this post 1.0, it would be very nice indeed to have
> > > > set,get,swapcontext.
> > >
> > > One approach to setcontext would be using rt_sigreturn, but I've
> > > heard there are issues using it for setcontext involving the
> > > alternate signal stack. It's the only way to do resuming _async_
> > > (i.e. the ucontext received by a signal handler for the state it
> > > interrupted) contexts though, so maybe there's some way to make it
> > > work. This issue was discussed recently on libc-alpha (the glibc
> > > list).
> > 
> > I am not interested in the async case not sure if other users are. If
> > I read the glibc discussion correctly they are not supporting this
> > any more?
> 
> I think that's intended. The whole idea of *context is to be able to do
> user-space stack switching to implement co-operative threading (or
> "fibers" or "green threads" or whet ever you want to call them). Being
> async safe is not requirement for this.
> 
> setcontext should be fast or the whole point of it is lost. So it
> should not do syscalls (signal mask twiddling).

Saving and restoring the signal mask is required anyway; this has
nothing to do with switching between async signal contexts, but simply
the fact that individual contexts can have their signal masks changed
manually. One benefit of using rt_sigreturn, if we could, is that it
would restore the signal mask automatically along with doing the
register context restoration.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.