Back to index

salome-gui  6.5.0
Public Member Functions | Private Attributes
CASCatch_CatchSignals Class Reference

This class controls an exception handling. More...

#include <CASCatch_CatchSignals.hxx>

List of all members.

Public Member Functions

Standard_EXPORT CASCatch_CatchSignals ()
 Public -.
Standard_EXPORT void Destroy ()
 Private -.
 ~CASCatch_CatchSignals ()
Standard_EXPORT void Activate ()
 Public -.
Standard_EXPORT void Deactivate ()
 Public -.

Private Attributes

Standard_Address mySigStates [7]
 stores signals' handler functions
Standard_Integer myFloatOpWord
 stores a float operation word, private
Standard_Boolean myIsActivated
 stores a flag whether a catcher is activated, private]

Detailed Description

This class controls an exception handling.

Definition at line 36 of file CASCatch_CatchSignals.hxx.


Constructor & Destructor Documentation

Public -.

creates a CASCatch_CatchSignals

Definition at line 40 of file CASCatch_CatchSignals.cxx.

     :myIsActivated(Standard_False)
{

  Standard_Integer i = 0;
  for(; i<=MAX_HANDLER_NUMBER; i++)
    mySigStates[i] = NULL;
}

Definition at line 44 of file CASCatch_CatchSignals.hxx.

{ Destroy(); }

Here is the call graph for this function:


Member Function Documentation

Public -.

activates a signals handling

Definition at line 148 of file CASCatch_CatchSignals.cxx.

{  
  if(myIsActivated) return;

  struct sigaction act;

  Standard_Integer i = 0;
  for(; i<=MAX_HANDLER_NUMBER; i++)  
    mySigStates[i] = new struct sigaction(); //Initialize structures

  int stat;
  act.sa_handler =  (SIG_PFV) &Handler ;
  sigemptyset(&act.sa_mask) ;


  stat = sigaction(SIGHUP,&act,(struct sigaction*)mySigStates[0]);    // ...... hangup
  stat = sigaction(SIGFPE,&act,(struct sigaction*) mySigStates[1]);   // ...... floating point exception
  stat = sigaction(SIGINT,&act,(struct sigaction*)mySigStates[2]);   // ...... interrupt
  stat = sigaction(SIGQUIT,&act,(struct sigaction*)mySigStates[3]);  // ...... quit
  stat = sigaction(SIGBUS,&act,(struct sigaction*)mySigStates[4]);   // ...... bus error
  stat = sigaction(SIGILL,&act,(struct sigaction*)mySigStates[5]);   // ...... illegal instruction

#ifdef SA_RESTART
  act.sa_flags   = SA_RESTART ;
#else
  act.sa_flags   = 0 ;
#endif
  act.sa_handler = (SIG_PFV) &SegvHandler ;

#ifdef SA_SIGINFO       // OSF,SOLARIS,IRIX
  act.sa_flags = act.sa_flags | SA_SIGINFO ;
# ifdef SOLARIS
  act.sa_sigaction = (void(*)(int, siginfo_t *, void*)) &SegvHandler ;
# endif
#endif

  stat = sigaction( SIGSEGV , &act , (struct sigaction*)mySigStates[6]);    // ...... segmentation violation

  myIsActivated = Standard_True;
}

Here is the call graph for this function:

Public -.

deactivates a signals handling

Definition at line 195 of file CASCatch_CatchSignals.cxx.

{
  if(!myIsActivated) return;

  struct sigaction oact;
  int stat;

  stat = sigaction(SIGHUP,(struct sigaction*)mySigStates[0],&oact);   // ...... hangup
  stat = sigaction(SIGFPE,(struct sigaction*)mySigStates[1],&oact);   // ...... floating point exception
  stat = sigaction(SIGINT,(struct sigaction*)mySigStates[2],&oact);   // ...... interrupt
  stat = sigaction(SIGQUIT,(struct sigaction*)mySigStates[3],&oact);  // ...... quit
  stat = sigaction(SIGBUS,(struct sigaction*)mySigStates[4],&oact);   // ...... bus error
  stat = sigaction(SIGILL,(struct sigaction*)mySigStates[5],&oact);   // ...... illegal instruction
  stat = sigaction(SIGSEGV,(struct sigaction*)mySigStates[6],&oact);  // ...... segmentation violation


  Standard_Integer i = 0;
  for(; i<=MAX_HANDLER_NUMBER; i++)
    delete (struct sigaction*)mySigStates[i];

  myIsActivated = Standard_False;
}

Here is the caller graph for this function:

Private -.

deactivates a signals handling

Definition at line 335 of file CASCatch_CatchSignals.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

stores a float operation word, private

Definition at line 58 of file CASCatch_CatchSignals.hxx.

stores a flag whether a catcher is activated, private]

Definition at line 63 of file CASCatch_CatchSignals.hxx.

CASCatch_CatchSignals::mySigStates[7], private [private]

stores signals' handler functions

Definition at line 53 of file CASCatch_CatchSignals.hxx.


The documentation for this class was generated from the following files: