Open CASCADE Technology
7.6.0
|
Set of Operating System Dependent (OSD) tools. More...
#include <OSD.hxx>
Static Public Member Functions | |
static void | SetSignal (OSD_SignalMode theSignalMode, Standard_Boolean theFloatingSignal) |
Sets or removes signal and FPE (floating-point exception) handlers. OCCT signal handlers translate signals raised by C subsystem to C++ exceptions inheriting Standard_Failure. More... | |
static void | SetSignal (const Standard_Boolean theFloatingSignal=Standard_True) |
Sets signal and FPE handlers. Short-cut for OSD::SetSignal (OSD_SignalMode_Set, theFloatingSignal). More... | |
static void | SetThreadLocalSignal (OSD_SignalMode theSignalMode, Standard_Boolean theFloatingSignal) |
Initializes thread-local signal handlers. This includes _set_se_translator() on Windows platform, and SetFloatingSignal(). The main purpose of this method is initializing handlers for newly created threads without overriding global handlers (set by application or by OSD::SetSignal()). More... | |
static void | SetFloatingSignal (Standard_Boolean theFloatingSignal) |
Enables / disables generation of C signal on floating point exceptions (FPE). This call does NOT register a handler for signal raised in case of FPE - SetSignal() should be called beforehand for complete setup. Note that FPE setting is thread-local, new threads inherit it from parent. More... | |
static OSD_SignalMode | SignalMode () |
Returns signal mode set by the last call to SetSignal(). By default, returns OSD_SignalMode_AsIs. More... | |
static Standard_Boolean | ToCatchFloatingSignals () |
Returns true if floating point exceptions will raise C signal according to current (platform-dependent) settings in this thread. More... | |
static void | SecSleep (const Standard_Integer theSeconds) |
Commands the process to sleep for a number of seconds. More... | |
static void | MilliSecSleep (const Standard_Integer theMilliseconds) |
Commands the process to sleep for a number of milliseconds. More... | |
static Standard_Boolean | RealToCString (const Standard_Real aReal, Standard_PCharacter &aString) |
Converts aReal into aCstring in exponential format with a period as decimal point, no thousand separator and no grouping of digits. The conversion is independent from the current locale. More... | |
static Standard_Boolean | CStringToReal (const Standard_CString aString, Standard_Real &aReal) |
Converts aCstring representing a real with a period as decimal point, no thousand separator and no grouping of digits into aReal. More... | |
static void | ControlBreak () |
since Windows NT does not support 'SIGINT' signal like UNIX, then this method checks whether Ctrl-Break keystroke was or not. If yes then raises Exception_CTRL_BREAK. More... | |
static Standard_Integer | SignalStackTraceLength () |
Returns a length of stack trace to be put into exception redirected from signal; 0 by default meaning no stack trace. More... | |
static void | SetSignalStackTraceLength (Standard_Integer theLength) |
Sets a length of stack trace to be put into exception redirected from signal. More... | |
Set of Operating System Dependent (OSD) tools.
|
static |
since Windows NT does not support 'SIGINT' signal like UNIX, then this method checks whether Ctrl-Break keystroke was or not. If yes then raises Exception_CTRL_BREAK.
|
static |
Converts aCstring representing a real with a period as decimal point, no thousand separator and no grouping of digits into aReal.
The conversion is independent from the current locale.
|
static |
Commands the process to sleep for a number of milliseconds.
|
static |
Converts aReal into aCstring in exponential format with a period as decimal point, no thousand separator and no grouping of digits. The conversion is independent from the current locale.
|
static |
Commands the process to sleep for a number of seconds.
|
static |
Enables / disables generation of C signal on floating point exceptions (FPE). This call does NOT register a handler for signal raised in case of FPE - SetSignal() should be called beforehand for complete setup. Note that FPE setting is thread-local, new threads inherit it from parent.
|
inlinestatic |
Sets signal and FPE handlers. Short-cut for OSD::SetSignal (OSD_SignalMode_Set, theFloatingSignal).
|
static |
Sets or removes signal and FPE (floating-point exception) handlers. OCCT signal handlers translate signals raised by C subsystem to C++ exceptions inheriting Standard_Failure.
Compiled with MS VC++ sets 3 main handlers:
This approach ensures that regardless of the option the user chooses to compile his code with (/EHs or /EHa), signals (or SE exceptions) will be translated into Open CASCADE C++ exceptions.
MinGW should use SEH exception mode for signal handling to work.
OSD::SetSignal() sets handlers (via ::sigaction()) for multiple signals (SIGFPE, SIGSEGV, etc).
If theFloatingSignal is TRUE then floating point exceptions will generate SIGFPE in accordance with the mask
If theFloatingSignal is FALSE then floating point calculations will gracefully complete regardless of occurred exceptions (e.g. division by zero). Otherwise the (thread-specific) FPE flags are set to raise signal if one of floating-point exceptions (division by zero, overflow, or invalid operation) occurs.
The recommended approach is to call OSD::SetSignal() in the beginning of the execution of the program, in function main() or its equivalent. In multithreaded programs it is advisable to call OSD::SetSignal() or OSD::SetThreadLocalSignal() with the same parameters in other threads where OCCT is used, to ensure consistency of behavior.
Note that in order to handle signals as C++ exceptions on Linux and under MinGW on Windows it is necessary to compile both OCCT and application with OCC_CONVERT_SIGNALS macro, and use macro OCC_CATCH_SIGNALS within each try{} block that has to catch this kind of exceptions.
Refer to documentation of Standard_ErrorHandler.hxx for details.
|
static |
Sets a length of stack trace to be put into exception redirected from signal.
|
static |
Initializes thread-local signal handlers. This includes _set_se_translator() on Windows platform, and SetFloatingSignal(). The main purpose of this method is initializing handlers for newly created threads without overriding global handlers (set by application or by OSD::SetSignal()).
|
static |
Returns signal mode set by the last call to SetSignal(). By default, returns OSD_SignalMode_AsIs.
|
static |
Returns a length of stack trace to be put into exception redirected from signal; 0 by default meaning no stack trace.
|
static |
Returns true if floating point exceptions will raise C signal according to current (platform-dependent) settings in this thread.