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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2