Xref: utzoo comp.lang.misc:5466 comp.unix.internals:196 Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!usc!snorkelwacker!apple!motcsd!lance From: lance@motcsd.csd.mot.com (lance.norskog) Newsgroups: comp.lang.misc,comp.unix.internals Subject: Re: Unix error handling Summary: Older than that, bucko! Message-ID: <1448@greek.csd.mot.com> Date: 10 Sep 90 23:27:17 GMT References: <1990Aug31.190751.12522@dg-rtp.dg.com> Followup-To: comp.lang.misc Distribution: usa Organization: Motorola CSD, Cupertino CA Lines: 26 Setjmp() and longjmp() are the basis of UNIX process-switching, and they've been in the kernel since Version 6 (1976?) and probably since the original PDP-11 assembler implementation. This pair are: void setjmp(jump buf) void longjmp(jump buf) The user-library pair have been around for probably as long: int setjmp(jump buf) void longmmp(jump buf, return val) switch (setjmp(jumpbuf)) { case 0: original case 1: abort default: panic, can't happen } abort: longjmp(jumpbuf, 1); Setjmp() in the user library returns 0 for the setup call, and the longjmp-supplied value when it comes back from a longjmp(). The kernel pair lacks this functionality. Of course, better languages let you save off multiple running stacks and resume them...