Path: utzoo!mnetor!uunet!husc6!bbn!mit-eddie!uw-beaver!uw-june!pardo
From: pardo@june.cs.washington.edu (David Keppel)
Newsgroups: comp.lang.c
Subject: longjmp() over several stacks
Message-ID: <4865@june.cs.washington.edu>
Date: 9 May 88 05:46:12 GMT
Reply-To: pardo@june.cs.washington.edu (David Keppel)
Organization: U of Washington, Computer Science, Seattle
Lines: 25
Summary: lightweight processes longjmp off one onto another

Question about the (portable) definition of longjmp():

I'm writing (yet another) lightweight process manager.  I malloc() off
a bunch of little stacks.  I'd like to be able to terminate on
abnormal conditions by doing a longjmp() from any given stack to the
original ("heavyweight") stack and cleaning up the package.

It seems "obvious" to me that I can't just go longjmp()ing across
random stacks, but I wonder if

+ it is possible to portably jump back to the original stack from any
  arbitrary stack (e.g., longjmp() is guaranteed to be implemented so
  this will work)
+ whether I can force this to be portable (e.g., the dynamic link of
  the first frame on any stack always points to the "heavy" stack)
+ or this is definitely going to break on some machine(s).

Please reply directly, as I'm sure people would rather be reading
about "goto" (:-).  I'll summerize (or is that winterize?) if there's
sufficient interest.

	;-D on  ( All tanked up and nowhere to go )  Pardo

		..!ucbvax!uw-beaver!uw-june!pardo
		    pardo@june.cs.washington.edu