libassa  3.5.1
Public Member Functions | Private Attributes | List of all members
ASSA::SIGUSR2Handler Class Reference

Class SIGUSR2Handler handles SIGUSR2 signal. More...

#include <Handlers.h>

Inheritance diagram for ASSA::SIGUSR2Handler:
ASSA::EventHandler

Public Member Functions

 SIGUSR2Handler ()
 Constructor. More...
 
int handle_signal (int signum_)
 Catch USR2 signal and increment count. More...
 
sig_atomic_t received_count () const
 Report count of received signals. More...
 
void resetState ()
 Set received signals count back to 0. More...
 
- Public Member Functions inherited from ASSA::EventHandler
 EventHandler ()
 Constructor. More...
 
virtual ~EventHandler ()
 Virtual destructor. More...
 
virtual int handle_read (int fd)
 Read event callback. More...
 
virtual int handle_write (int fd)
 Write handler callback. More...
 
virtual int handle_except (int fd)
 Exception handler callback. More...
 
virtual int handle_timeout (TimerId tid)
 Timeout handler callback. More...
 
virtual int handle_close (int fd)
 EOF on peer socket handler callback. More...
 
void set_id (const std::string &id_)
 Set EventHandler ID. More...
 
std::string get_id () const
 Retrieve EventHandler ID. More...
 

Private Attributes

sig_atomic_t m_count
 Received signals count. More...
 

Additional Inherited Members

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

Detailed Description

Class SIGUSR2Handler handles SIGUSR2 signal.

Definition at line 150 of file Handlers.h.

Constructor & Destructor Documentation

◆ SIGUSR2Handler()

ASSA::SIGUSR2Handler::SIGUSR2Handler ( )
inline

Constructor.

Definition at line 155 of file Handlers.h.

155  : m_count(0) {
156  trace_with_mask("SIGUSR2Handler::SIGUSR2Handler", SIGHAND);
157  }
#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_count
Received signals count.
Definition: Handlers.h:182
@ SIGHAND
Class SigHandler(s) messages
Definition: LogMask.h:38

References ASSA::SIGHAND, and trace_with_mask.

Member Function Documentation

◆ handle_signal()

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

Catch USR2 signal and increment count.

Reimplemented from ASSA::EventHandler.

Definition at line 161 of file Handlers.h.

161  {
162  trace_with_mask("SIGUSR2Handler::handle_signal()", SIGHAND);
163 
164  if (signum_ == SIGUSR2) {
165  m_count++;
166  DL((TRACE, "signal count = %d\n", m_count));
167  return 0;
168  }
169  return -1;
170  }
#define DL(X)
A macro for writing debug message to the Logger.
Definition: Logger.h:273
@ TRACE
Function call trace
Definition: LogMask.h:26

References DL, m_count, ASSA::SIGHAND, ASSA::TRACE, and trace_with_mask.

◆ received_count()

sig_atomic_t ASSA::SIGUSR2Handler::received_count ( ) const
inline

Report count of received signals.

Definition at line 174 of file Handlers.h.

174 { return m_count; }

References m_count.

◆ resetState()

void ASSA::SIGUSR2Handler::resetState ( void  )
inlinevirtual

Set received signals count back to 0.

Reimplemented from ASSA::EventHandler.

Definition at line 178 of file Handlers.h.

178 { m_count = 0; }

References m_count.

Member Data Documentation

◆ m_count

sig_atomic_t ASSA::SIGUSR2Handler::m_count
private

Received signals count.

Definition at line 182 of file Handlers.h.

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


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