mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-13 14:27:08 +03:00
0028217: Error handling is not thread safe and causing memory corruption and sporadic crashes
Static variable holding handle to the last raised exception is made thread-local on compilers that support C++11 keyword thread_local (MCVC++ 14+, GCC 4.8+, ICC 14+, CLang). Test bugs fclasses bug28217 is added (BAD on vc < 14 and gcc < 4.8). Test case tuning bugs/fclasses/bug28217
This commit is contained in:
@@ -58,12 +58,22 @@ static void deallocate_message(Standard_CString aMessage)
|
||||
}
|
||||
}
|
||||
|
||||
// Define Standard_THREADLOCAL modifier as C++11 thread_local keyword
|
||||
// where it is available.
|
||||
#if (defined(__INTEL_COMPILER) && __INTEL_COMPILER > 1400) || \
|
||||
(defined(__clang__)) /* assume standard CLang > 3.3 or XCode >= 8 */ || \
|
||||
(defined(_MSC_VER) && _MSC_VER >= 1800) /* MSVC++ >= 14 */ || \
|
||||
(defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))) /* GCC >= 4.8 */
|
||||
#define Standard_THREADLOCAL thread_local
|
||||
#else
|
||||
#define Standard_THREADLOCAL
|
||||
#endif
|
||||
|
||||
// ******************************************************************
|
||||
// Standard_Failure *
|
||||
// ******************************************************************
|
||||
#ifndef NO_CXX_EXCEPTION
|
||||
static Handle(Standard_Failure) RaisedError;
|
||||
static Standard_THREADLOCAL Handle(Standard_Failure) RaisedError;
|
||||
#endif
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
|
Reference in New Issue
Block a user