Make C Interface exceptions thread local.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-07-28 18:35:42 +02:00
parent 5fda89bc72
commit 1000893652
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 3 additions and 4 deletions

View File

@ -1,4 +1,3 @@
#include "Core.hpp"
std::string ExceptionHandler::_lastException = "";
export const char* Arbutils_C_GetLastException() { return ExceptionHandler::GetLastException(); }

View File

@ -9,11 +9,11 @@
#define ArbutilsException 3;
class ExceptionHandler {
static std::string _lastException;
static thread_local std::string _ArbutilsLastException;
public:
static void SetLastException(const std::exception& e) { _lastException = std::string(e.what()); }
static const char* GetLastException() { return _lastException.c_str(); }
static void SetLastException(const std::exception& e) { _ArbutilsLastException = std::string(e.what()); }
static const char* GetLastException() { return _ArbutilsLastException.c_str(); }
};
#define Try(data) \