From: olk on
I've some code which provides the functionality of UNIX ucontext
(makecotnext()/swapcontext()). It is supposed to replace WIN32 Fiber
(because fibers have some limitations -> can not be migrated between
threads etc.). The code uses inline assembler and works until the
defered function throws an exception.
In this case I get an unhandled exception fault even if I've an
try/catch block (event with catch(...)).
I guess that I've to install some code which enables the exception
handling for the new context.
Any hints?!
From: m on
Have a look at these articles

http://www.microsoft.com/msj/0197/Exception/Exception.aspx
http://msdn.microsoft.com/en-us/magazine/cc301714.aspx

and then you might want to look at SEH & C++ exception handling topics in
MSDN too.

Also note that C++ exception handling has various limitations depending on
your compiler options and is a 'feature' I consider so broken that I never
use. Notwithstanding my prejudice, most likely, your context changing
algorithm is interfering with the lookup of frame handlers (either C++ or
SEH), but the bigger issue is how you will unwind the stack across fibre
contexts. I assume that in your implementation the thread is just a host
and of an exception occurs in the fibre that it happens to be running, then
that fibre should ABEND and the thread resume processing the next work item
so that you need to ensure that the stack always contains a 'root' context
and a 'call' into the fibre rountine.

You should also be aware that in Microsoft compilers inline assembly is
depreciated for x86 and not supported for x64. I highly recommend that you
abandon it and switch to a separate assembler like MSASM and only implement
whole functions in assembly language.

"olk" <oliver.kowalke(a)gmx.de> wrote in message
news:hngmfd$v8a$03$1(a)news.t-online.com...
> I've some code which provides the functionality of UNIX ucontext
> (makecotnext()/swapcontext()). It is supposed to replace WIN32 Fiber
> (because fibers have some limitations -> can not be migrated between
> threads etc.). The code uses inline assembler and works until the defered
> function throws an exception.
> In this case I get an unhandled exception fault even if I've an try/catch
> block (event with catch(...)).
> I guess that I've to install some code which enables the exception
> handling for the new context.
> Any hints?!