longjmp() over several stacks

David Keppel pardo at june.cs.washington.edu
Mon May 9 15:46:12 AEST 1988


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 at june.cs.washington.edu



More information about the Comp.lang.c mailing list