(file) Return to Signal.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

  1 mike  1.2 //%//-*-c++-*-/////////////////////////////////////////////////////////////////
  2           // Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM
  3           //
  4           // Permission is hereby granted, free of charge, to any person obtaining a copy
  5           // of this software and associated documentation files (the "Software"), to
  6           // deal in the Software without restriction, including without limitation the
  7           // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8           // sell copies of the Software, and to permit persons to whom the Software is
  9           // furnished to do so, subject to the following conditions:
 10           //
 11           // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 12           // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 13           // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 14           // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 15           // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 16           // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 17           // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 18           // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 19           //
 20           //==============================================================================
 21           //
 22 mike  1.2 // Author: Markus Mueller (markus_mueller@de.ibm.com
 23           //
 24           // Modified By: 
 25           //
 26           //%/////////////////////////////////////////////////////////////////////////////
 27           
 28           
 29           #ifndef Pegasus_SignalHandler_h
 30           #define Pegasus_SignalHandler_h
 31           
 32 mike  1.3 // REVIEW: Where is this signal handling code used?
 33           
 34           // REVIEW: Is there an equivalent implementation for Windows?
 35           
 36           
 37 mike  1.2 // // Ensure Unix 98
 38           // #ifdef PEGASUS_PLATFORM_LINUX_IX86_GNU
 39           //    #ifndef _GNU_SOURCE
 40           //       #define _GNU_SOURCE
 41           //    #endif
 42           // #else
 43           //    #ifdef _XOPEN_SOURCE
 44           //       #undef _XOPEN_SOURCE
 45           //    #endif
 46           //    #define _XOPEN_SOURCE 600
 47           // #endif
 48           
 49           #include <signal.h>
 50           
 51           typedef void (* signal_handler)(int,siginfo_t *,void *);
 52           
 53           typedef struct {
 54               int active;
 55               signal_handler sh;
 56               struct sigaction oldsa;
 57           } register_handler;
 58 mike  1.2 
 59           #include <Pegasus/Common/Thread.h>
 60           #include <Pegasus/Common/DQueue.h>
 61           #include <Pegasus/Common/Exception.h>
 62           
 63           // used locally as standard response to stop the failing thread normally
 64           void sig_act(int s_n, siginfo_t * s_info, void * sig);
 65           // test routine, that just causes a segmentation fault
 66           void * segmentation_faulter(void * parm);
 67           
 68           PEGASUS_NAMESPACE_BEGIN
 69           
 70           class PEGASUS_COMMON_LINKAGE SignalHandler
 71           {
 72              public:
 73                 SignalHandler();
 74           
 75                 ~SignalHandler(); // deactivate all registered handlers
 76           
 77                 // these functions should throw exceptions
 78           
 79 mike  1.2       void registerHandler(Uint32 signum, signal_handler _sighandler);
 80           
 81                 void activate(Uint32 signum);
 82           
 83                 //void activateAll();
 84           
 85                 void deactivate(Uint32 signum);
 86           
 87                 void deactivateAll();
 88           
 89                 static void ignore(Uint32 signum);
 90           
 91              private:
 92           
 93                 register_handler reg_handler[32];
 94                 Mutex reg_mutex;
 95           
 96                 void deactivate_i(Uint32 signum);
 97           
 98           };
 99           
100 mike  1.2 SignalHandler * getSigHandle();
101           
102           PEGASUS_NAMESPACE_END
103           
104           #endif // Pegasus_SignalHandler_h

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2