Hi,
I get SIGSEGV on macOS when I switch an execution_context from a catch
block with one thread and than switch back with another thread.
Segmentation fault happens in libc++abi.dylib`__cxa_end_catch
Does anyone have any ideas, what it could be? Is it legal to switch
thread under an excecution_context while it's within a catch block?
A minimal example is here:
#include
#include <future>
using Context = boost::context::execution_context<void>;
Context Main(Context context) {
try {
throw std::runtime_error("123");
} catch (const std::exception& ex) {
context = context();
}
return context();
}
int main() {
Context context(&Main);
context = context();
std::thread([&] { context = context(); }).join();
return 0;
}
I see the problem on macOS with clang++ but can't reproduce on a linux with g++.
$ uname -ap
Darwin air.local 16.3.0 Darwin Kernel Version 16.3.0: Thu Nov 17
20:23:58 PST 2016; root:xnu-3789.31.2~1/RELEASE_X86_64 x86_64 i386
$ clang++ --version
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin16.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
--
Thanks,
Alexander Pronchenkov