version 1.26, 2008/02/20 09:46:30
|
version 1.27, 2008/02/27 20:16:18
|
|
|
#include <Pegasus/Common/Linkage.h> | #include <Pegasus/Common/Linkage.h> |
#include <Pegasus/Common/Mutex.h> | #include <Pegasus/Common/Mutex.h> |
| |
// // Ensure Unix 98 |
|
// #ifdef PEGASUS_PLATFORM_LINUX_IX86_GNU |
|
// #ifndef _GNU_SOURCE |
|
// #define _GNU_SOURCE |
|
// #endif |
|
// #else |
|
// #ifdef _XOPEN_SOURCE |
|
// #undef _XOPEN_SOURCE |
|
// #endif |
|
// #define _XOPEN_SOURCE 600 |
|
// #endif |
|
|
|
#ifdef PEGASUS_HAS_SIGNALS | #ifdef PEGASUS_HAS_SIGNALS |
| |
# include <signal.h> | # include <signal.h> |
|
|
#endif // PEGASUS_HAS_SIGNALS | #endif // PEGASUS_HAS_SIGNALS |
| |
| |
#if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || (PEGASUS_OS_SOLARIS) |
|
extern "C" { | extern "C" { |
#endif |
|
|
|
typedef void (* signal_handler)(int, PEGASUS_SIGINFO_T *, void *); | typedef void (* signal_handler)(int, PEGASUS_SIGINFO_T *, void *); |
|
|
#if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || (PEGASUS_OS_SOLARIS) |
|
} | } |
#endif |
|
|
|
// Sample signal handler for SIGABRT that stops the failing thread normally |
|
void sig_act(int s_n, PEGASUS_SIGINFO_T * s_info, void * sig); |
|
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
|
| |
// these functions should throw exceptions | // these functions should throw exceptions |
| |
void registerHandler(unsigned signum, signal_handler _sighandler); |
/** |
|
Registers a signal handler. |
|
@param signum The signal number for which to register the handler. |
|
@sighandler The signal handler to register |
|
@exception IndexOutOfBoundsException if signum is outside the range |
|
of signals supported by the SignalHandler (see PEGASUS_NSIG). |
|
*/ |
|
void registerHandler(unsigned signum, signal_handler sighandler); |
|
|
|
/** |
|
Activates a signal handler. |
|
@param signum The signal number for which to activate the handler. |
|
@exception IndexOutOfBoundsException if signum is outside the range |
|
of signals supported by the SignalHandler (see PEGASUS_NSIG). |
|
*/ |
void activate(unsigned signum); | void activate(unsigned signum); |
| |
//void activateAll(); |
/** |
|
Deactivates a signal handler. |
|
@param signum The signal number for which to deactivate the handler. |
|
@exception IndexOutOfBoundsException if signum is outside the range |
|
of signals supported by the SignalHandler (see PEGASUS_NSIG). |
|
*/ |
void deactivate(unsigned signum); | void deactivate(unsigned signum); |
| |
void deactivateAll(); | void deactivateAll(); |
| |
|
/** |
|
Sets a signal action to "ignore". |
|
@param signum The signal number to ignore. |
|
@exception IndexOutOfBoundsException if signum is outside the range |
|
of signals supported by the SignalHandler (see PEGASUS_NSIG). |
|
*/ |
static void ignore(unsigned signum); | static void ignore(unsigned signum); |
| |
|
/** |
|
Resets a signal action to its default. |
|
@param signum The signal number for which to reset the signal action. |
|
@exception IndexOutOfBoundsException if signum is outside the range |
|
of signals supported by the SignalHandler (see PEGASUS_NSIG). |
|
*/ |
static void defaultAction(unsigned signum); | static void defaultAction(unsigned signum); |
| |
private: | private: |