For a block invoke to another thread, safe and restore

* In future we could handle async exceptions by storing the exception
  information in a std::function derived object (instead of the separate
  ExceptionHandling that lives on the stack) and query it out in a new
  WaitForInvoke function maybe. Right now we just print the exception
  to the output log and abort the callback.
This commit is contained in:
baldurk
2017-08-03 16:20:28 +01:00
parent 1c93ee9441
commit 87ef595cce
6 changed files with 88 additions and 17 deletions
@@ -829,3 +829,18 @@ extern "C" void HandleException(PyObject *global_handle)
if(redirector->context)
emit redirector->context->exception(typeStr, valueStr, frames);
}
extern "C" bool IsThreadBlocking(PyObject *global_handle)
{
OutputRedirector *redirector = (OutputRedirector *)global_handle;
if(redirector && redirector->context)
return redirector->context->threadBlocking();
return false;
}
extern "C" void SetThreadBlocking(PyObject *global_handle, bool block)
{
OutputRedirector *redirector = (OutputRedirector *)global_handle;
if(redirector && redirector->context)
return redirector->context->setThreadBlocking(block);
}