Disable parallel ucontexts on 64bit SunOS.
Ucontexts and TLS don't play well together on this platform.
For the record, here is a sample test code. The output should be the same before and after
swapcontext (recall that option "-m64" may be mandatory to compile in 64bit mode).
--------------------
#include <iostream>
#include <stdexcept>
#include <system_error>
#include <thread>
#include <ucontext.h>
thread_local int x = 1;
static char stack[66536];
static ucontext_t ctx;
static ucontext_t octx;
static void wrap()
{
std::cerr << "o. After swapcontext...: x = " << x << " (" << std::this_thread::get_id() << ")\n";
}
static void thread_fun()
{
x = 2;
std::this_thread::sleep_for(std::chrono::milliseconds(100));
ctx.uc_stack.ss_sp = stack;
ctx.uc_stack.ss_size = sizeof(stack);
ctx.uc_link = &octx;
makecontext(&ctx, &wrap, 2, (int)0xdeadbeef);
std::cerr << "o. Before swapcontext..: x = " << x << " (" << std::this_thread::get_id() << ")\n";
swapcontext(&octx, &ctx);
std::cerr << "o. Finish of thread....: x = " << x << " (" << std::this_thread::get_id() << ")\n";
}
int main()
{
std::cerr << "x. Main (before thread): x = " << x << " (" << std::this_thread::get_id() << ")\n";
std::thread thr(thread_fun);
getcontext(&ctx);
thr.join();
std::cerr << "x. Main (after join)...: x = " << x << " (" << std::this_thread::get_id() << ")\n";
}