Path: utzoo!attcan!uunet!samsung!sdd.hp.com!decwrl!ucbvax!mindcrf.UUCP!karish From: karish@mindcrf.UUCP (Chuck Karish) Newsgroups: comp.unix.questions Subject: Re: Is there a way not to use global variables for signal,setjmp,lonjmp? Summary: Huh? Message-ID: <9009170633.AA23056@mindcrf.mindcraft.com> Date: 17 Sep 90 06:33:02 GMT References: <119@wookie.dbaccess.com> Sender: daemon@ucbvax.BERKELEY.EDU Organization: Mindcraft, Inc. Lines: 26 In article <119@wookie.dbaccess.com> ivan@dbaccess.com (Ivan Covdy) writes: >In: > signal( SignalValue, ActionFunction ); >the function ActionFunction can be defined only as: > void ActionFunction( int ); i.e., it can have only one argument. >What should I do if I want to have such ActionFunction, which changes >variables, and these variables should not be global/external/static? >Are there any ways to pass more arguments to ActionFunction? No. The user process doesn't pass ANY arguments to the signal-catching function. The system passes the signal number. >The same question is for setjmp(Env) and longjmp(Env, 0): > are there any ways to get rid of the global variable Env? There's no requirement that `Env' be a global variable. It's a structure into which setjmp() saves the process state at the time setjmp() is called. A process is allowed to save any number of non-global jmpbuf structures, and feed the structure of its choice to longjmp() to jump to the desired state. -- Chuck Karish karish@mindcraft.com Mindcraft, Inc. (415) 323-9000