libassa 3.5.1
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
ASSA::SIGINTHandler Class Reference

SIGINTHandler handles SIGINT signal. More...

#include <Handlers.h>

Inheritance diagram for ASSA::SIGINTHandler:
ASSA::EventHandler

Public Member Functions

 SIGINTHandler ()
 constructor
 
int handle_signal (int signum_)
 Receive SIGINT signal.
 
sig_atomic_t graceful_quit ()
 Indicates whether graceful quit signal has been raised by the signal handler.
 
void resetState ()
 Reset state of the object to initial.
 
- Public Member Functions inherited from ASSA::EventHandler
 EventHandler ()
 Constructor.
 
virtual ~EventHandler ()
 Virtual destructor.
 
virtual int handle_read (int fd)
 Read event callback.
 
virtual int handle_write (int fd)
 Write handler callback.
 
virtual int handle_except (int fd)
 Exception handler callback.
 
virtual int handle_timeout (TimerId tid)
 Timeout handler callback.
 
virtual int handle_close (int fd)
 EOF on peer socket handler callback.
 
void set_id (const std::string &id_)
 Set EventHandler ID.
 
std::string get_id () const
 Retrieve EventHandler ID.
 

Private Attributes

sig_atomic_t m_graceful_quit
 flag that indicates whether signal was caught.
 

Additional Inherited Members

- Protected Attributes inherited from ASSA::EventHandler
std::string m_id
 

Detailed Description

SIGINTHandler handles SIGINT signal.

Definition at line 45 of file Handlers.h.

Constructor & Destructor Documentation

◆ SIGINTHandler()

ASSA::SIGINTHandler::SIGINTHandler ( )
inline

constructor

Definition at line 71 of file Handlers.h.

73 : m_graceful_quit (0)
74{
75 trace_with_mask("SIGINTHandler::SIGINTHandler", SIGHAND);
76}
#define trace_with_mask(s, m)
trace_with_mask() is used to trace function call chain in C++ program.
Definition Logger.h:437
sig_atomic_t m_graceful_quit
flag that indicates whether signal was caught.
Definition Handlers.h:67
@ SIGHAND
Class SigHandler(s) messages
Definition LogMask.h:38

References ASSA::SIGHAND, and trace_with_mask.

Member Function Documentation

◆ graceful_quit()

sig_atomic_t ASSA::SIGINTHandler::graceful_quit ( )
inline

Indicates whether graceful quit signal has been raised by the signal handler.

Returns
0 if not, 1 othewise.

Definition at line 92 of file Handlers.h.

94{
95 return m_graceful_quit;
96}

References m_graceful_quit.

◆ handle_signal()

int ASSA::SIGINTHandler::handle_signal ( int  signum_)
inlinevirtual

Receive SIGINT signal.

Returns
0 if valid signum_ was used, -1 otherwise.

Reimplemented from ASSA::EventHandler.

Definition at line 79 of file Handlers.h.

81{
82 trace_with_mask("SIGINTHandler::handle_signal", SIGHAND);
83
84 if (signum_ == SIGINT) {
86 return 0;
87 }
88 return -1;
89}

References m_graceful_quit, ASSA::SIGHAND, and trace_with_mask.

◆ resetState()

void ASSA::SIGINTHandler::resetState ( void  )
inlinevirtual

Reset state of the object to initial.

Reimplemented from ASSA::EventHandler.

Definition at line 99 of file Handlers.h.

101{
102 trace_with_mask("SIGINTHandler::resetState", SIGHAND);
103
104 m_graceful_quit = 0;
105}

References m_graceful_quit, ASSA::SIGHAND, and trace_with_mask.

Member Data Documentation

◆ m_graceful_quit

sig_atomic_t ASSA::SIGINTHandler::m_graceful_quit
private

flag that indicates whether signal was caught.

Definition at line 67 of file Handlers.h.

Referenced by graceful_quit(), handle_signal(), and resetState().


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