[comp.unix.questions] longjmp

rsj@oxtrap.UUCP (Rick Jaffe) (04/18/88)

when it receives a signal (SIGUSR1) telling it not to bother: the
answer isn't needed any more.  The program assures that locks and
global variables won't cause any trouble, and executes a longjmp(3)
from the signal handler back up to the main procedure.

Is this "safe"?  Is there a better way, short of setting a global
flag, and then either returning from the several hundred procedure
calls or executing a longjmp() from inside the recursive procedure?

ajm@cit5.cit.oz (Tony Mcgregor) (09/04/89)

I am trying to use setjmp and longjump to do context switching within
a single process. I'm confused by the manual entry which says



>SETJMP(3C-ucb)	  Pyramid OSx Operating	System	   SETJMP(3C-ucb)
>
>[...]
>
>     longjmp(env, val)
>     jmp_buf env;
>
>[...]
>
>     Using setjmp/longjmp for context switching
>
>     Setjmp and	longjmp	can be used to switch between different
>     contexts withing a	single process.	
>
>[...]
>
>     NOTE: The argument given to	longjmp
>     is	ignored	when using longjmp to switch context.
>
>
>[...]
>
>	5)  Use	longjmp	with the appropriate (previously saved)
>	    context buffer to switch to	the new	context.
>


So how do I specify the context if longjmp ignores it's argument?

Thanks for your help.

Tony
----------------------------------------------------------------------------
Tony McGregor 
Department of Robotics and Digital Tech., Chisholm Institute of Technology
PO Box 197, Caulfield East, Vic 3145, Australia  
Phone: +61 3 5732014    Fax: +61 3 5721298    ACSNET: ajm@cit5.cit.oz
----------------------------------------------------------------------------