#include <cafe/os/OSException.h> #define OS_EXCEPTION_MODE_THREAD 1 #define OS_EXCEPTION_MODE_GLOBAL 2 #define OS_EXCEPTION_MODE_THREAD_ALL_CORES 3 #define OS_EXCEPTION_MODE_GLOBAL_ALL_CORES 4 typedef BOOL (*OSExceptionCallback)(OSContext* interruptedContext); OSExceptionCallback OSSetExceptionCallbackEx(OSExceptionMode exceptionMode, OSExceptionType exceptionType, OSExceptionCallback newCallback);
|exceptionMode||Exception mode to set callback.|
|exceptionType||Exception type to set callback.|
|newCallback||Pointer to the new exception callback.|
The existing callback pointer.
NULL is returned if no previous handler was installed.
NULL is a
valid value to set the specific exception handler to "do nothing".
For more information about exception callback usage, see
OSSetExceptionCallbackEx has four extended exception setting modes:
OS_EXCEPTION_MODE_THREAD- This behaves like the original
OSSetExceptionCallbackcall. This sets an exception handler per-thread per-core.
OS_EXCEPTION_MODE_GLOBAL- This allows a global per-core exception handler to be installed. If a thread has no defined exception handler, the global exception handler for the core is used.
OS_EXCEPTION_MODE_THREAD_ALL_CORES- This sets the exception handler per-thread for all cores. A thread can migrate to another core and still can call the desired per-thread exception handler.
OS_EXCEPTION_MODE_GLOBAL_ALL_CORES- This sets the global exception handler for all cores. A thread does not need to have a per-thread exception handler. This is useful for a thread which can migrate and is created without a per-thread exception handler.
OSSetExceptionCallbackEx allows global exception handlers to be set per-core that are different
than the per-thread exception handlers.
Currently, the policy for the per-core exception handler priority lookup is:
This allows one to handle exceptions without having to inherit the exception handler from a default thread (this is useful for threads, which are in different libraries).
|Callbacks||Do not call this function from any callback function.|
2014/04/18 Initial version.