Loading...
Searching...
No Matches
ASSA::SIGCHLDHandler Class Reference

Class SIGCHLDHandler handles SIGCHLD signal. More...

`#include <Handlers.h>`

Inheritance diagram for ASSA::SIGCHLDHandler:

## Public Member Functions

| SIGCHLDHandler ()
| Constructor.
int | handle_signal (int signum_)
| Receive CHLD signal.
sig_atomic_t | child_exited ()
| Did child exit?
void | resetState ()
| Reset child's exit state.
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_child_exit_flag
| Child exit's state.

## Additional Inherited Members

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

## Detailed Description

Class SIGCHLDHandler handles SIGCHLD signal.

Definition at line 187 of file Handlers.h.

## Constructor & Destructor Documentation

## SIGCHLDHandler()

ASSA::SIGCHLDHandler::SIGCHLDHandler | ( |  | ) |

inline

Constructor.

Definition at line 191 of file Handlers.h.

: m_child_exit_flag(0) {
trace_with_mask("SIGCHLDHandler::SIGCHLDHandler", SIGHAND);
}
trace_with_mask
#define trace_with_mask(s, m)
trace_with_mask() is used to trace function call chain in C++ program.
Definition Logger.h:437
ASSA::SIGCHLDHandler::m_child_exit_flag
sig_atomic_t m_child_exit_flag
Child exit's state.
Definition Handlers.h:216
ASSA::SIGHAND
@ SIGHAND
Class SigHandler(s) messages
Definition LogMask.h:38

References ASSA::SIGHAND, and trace_with_mask.

## Member Function Documentation

## child_exited()

sig_atomic_t ASSA::SIGCHLDHandler::child_exited | ( |  | ) |

inline

Did child exit?

Definition at line 208 of file Handlers.h.

{ return m_child_exit_flag; }

References m_child_exit_flag.

## handle_signal()

int ASSA::SIGCHLDHandler::handle_signal | ( | int | signum_ | ) |

inline virtual

Receive CHLD signal.

Reimplemented from ASSA::EventHandler.

Definition at line 197 of file Handlers.h.

{
trace_with_mask("SIGCHLDHandler::handle_signal", SIGHAND);
if (signum_ == SIGCHLD && wait(NULL) != -1) {
m_child_exit_flag = 1;
return 0;
}
return -1;
}

References m_child_exit_flag, ASSA::SIGHAND, and trace_with_mask.

## resetState()

void ASSA::SIGCHLDHandler::resetState | ( | void |  | ) |

inline virtual

Reset child's exit state.

Reimplemented from ASSA::EventHandler.

Definition at line 212 of file Handlers.h.

{ m_child_exit_flag = 0; }

References m_child_exit_flag.

## Member Data Documentation

## m_child_exit_flag

sig_atomic_t ASSA::SIGCHLDHandler::m_child_exit_flag

private

Child exit's state.

Definition at line 216 of file Handlers.h.

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

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

- Handlers.h