help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to exit out of a function ? what is try-catch-throw in terms of


From: David Thompson
Subject: Re: How to exit out of a function ? what is try-catch-throw in terms of Program Counter
Date: Sun, 02 Dec 2007 23:20:27 GMT

On Mon, 05 Nov 2007 06:07:25 +0100, "Alf P. Steinbach"
<address@hidden> wrote:

> * David Thompson:
> > On Sun, 21 Oct 2007 00:55:53 +0200, "Alf P. Steinbach"
> > <address@hidden> wrote:

> >> The closest equivalent in C would be a 'longjmp'.  However, a C++ 
> >> exception is more limited, in that it will only jump up the call chain, 
> > 
> > C longjmp/setjmp also is only guaranteed to work up the stack; the
> > fact that _some_ implementations can work cross-stack and in
> > particular cross-thread is not standard nor portable.
> 
> So?
> 
> But also, what on Earth do you mean by a cross-thread longjmp?  I 
> implemented coroutines in terms of longjmp at the time that was popular, 
> so the concepts involved are not unfamiliar to me.  Yet I fail to 
> envision what you could be talking about, especially as "fact".  I think 

IME 'coroutine' has been used for several slightly different concepts,
but if you mean the one of separate threads of control passing CPU
ownership often along with data anytime they choose, also known more
specifically as cooperative/nonpreemptive threading/tasking, yes. I
think you are agreeing that it did actually work, because 'restoring'
PC and SP (or equivalents) was enough; but I am pointing out it wasn't
and isn't _required_ to work that way.

> perhaps you're talking about restoring the full context (registers etc) 
> of a moment in a thread's execution?
> 
IME a cooperative switch itself doesn't need to save and restore other
state, as the language mechanism(s) e.g. 'call yield' handle it. Or
for cache-y things it happens automatically, or mostly automatically.

- formerly david.thompson1 || achar(64) || worldnet.att.net


reply via email to

[Prev in Thread] Current Thread [Next in Thread]