Re: [Linux-ia64] use of setcontext()/getcontext()

David Mosberger
2001-09-26T22:24:24Z

>>>>> On Tue, 25 Sep 2001 21:35:12 +0200 (CEST), stefan <stefan@lkcc.org> said:

Stefan> Hello list, I wonder if the above function set can be used
Stefan> to implement something like what is used to work on other
Stefan> types of machines with setjmp()/longjmp(). I would like to
Stefan> continue a program at a certain point of execution with a
Stefan> saved environment.

From this description, it sounds like you'd want to use swapcontext().
I don't quite understand your pseudo-code though (what's are
save_both_stacks()/restore_both_stacks() supposed to do?).

I do agree though that it would be nice to have a portable and
thread-safe way of determining whether or not a getcontext() is
returning for the first time. On ia64, I made getcontext() return
this information in register r9, but that's obviously not a portable
solution.

--david