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

Class SIGUSR1Handler. More...

#include <Handlers.h>

Inheritance diagram for ASSA::SIGUSR1Handler:
ASSA::EventHandler

Public Member Functions

 SIGUSR1Handler ()
 Constructor. More...
 
int handle_signal (int signum_)
 Catch USR1 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 SIGUSR1Handler.

Handle SIGUSR1 signal.

Definition at line 112 of file Handlers.h.

Constructor & Destructor Documentation

◆ SIGUSR1Handler()

ASSA::SIGUSR1Handler::SIGUSR1Handler ( )
inline

Constructor.

Definition at line 117 of file Handlers.h.

117  : m_count(0) {
118  trace_with_mask("SIGUSR1Handler::SIGUSR1Handler", SIGHAND);
119  }
#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:144
@ SIGHAND
Class SigHandler(s) messages
Definition: LogMask.h:38

References ASSA::SIGHAND, and trace_with_mask.

Member Function Documentation

◆ handle_signal()

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

Catch USR1 signal and increment count.

Reimplemented from ASSA::EventHandler.

Definition at line 123 of file Handlers.h.

123  {
124  trace_with_mask("SIGUSR1Handler::handle_signal()", SIGHAND);
125 
126  if (signum_ == SIGUSR1) {
127  m_count++;
128  DL((TRACE, "signal count = %d\n", m_count));
129  return 0;
130  }
131  return -1;
132  }
#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::SIGUSR1Handler::received_count ( ) const
inline

Report count of received signals.

Definition at line 136 of file Handlers.h.

136 { return m_count; }

References m_count.

◆ resetState()

void ASSA::SIGUSR1Handler::resetState ( void  )
inlinevirtual

Set received signals count back to 0.

Reimplemented from ASSA::EventHandler.

Definition at line 140 of file Handlers.h.

140 { m_count = 0; }

References m_count.

Member Data Documentation

◆ m_count

sig_atomic_t ASSA::SIGUSR1Handler::m_count
private

Received signals count.

Definition at line 144 of file Handlers.h.

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


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