Boost logo

Boost Users :

Subject: Re: [Boost-users] [context] Crash in case of exception from a context
From: Nathaniel Fries (nfries88_at_[hidden])
Date: 2015-03-14 01:37:40


The problem here is most likely due to Visual C++ using SEH to implement
C++ exceptions. SEH uses a linked list of function pointers on the stack to
process exceptions. SEH requires this linked list be on the stack, and will
kill the process if it encounters one that is not. SEH is also used for
normally fatal program errors (divide by zero, null pointer dereference,
invalid instruction, etc) no matter what compiler is used, so even MinGW or
any other C++ compiler will need this change for everything to work as it
should.

The solution is actually pretty simple - push the current SEH list's head
onto the stack before the context switch, and restore it when resuming
execution, with each context initializing its own list with
UnhandledExceptionFilter during either construction or first run (like a
new thread would). But maybe such a fix is out of scope for the context
library?l



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net