BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
Public Types | Static Public Member Functions | Static Protected Member Functions
BeeeOn::PosixSignal Class Reference

The class implements working with POSIX signals. More...

#include <PosixSignal.h>

Public Types

typedef std::function< void(unsigned
int)> 
Handler
 

Static Public Member Functions

static void send (long pid, const std::string name)
 
static void send (const Poco::Thread &thread, const std::string &name)
 
static void ignore (const std::string &name)
 
static void handle (const std::string &name, Handler handler)
 
static void trapFatal ()
 

Static Protected Member Functions

static unsigned int byName (const std::string &name)
 
static void send (long pid, unsigned int num)
 
static void send (const Poco::Thread &thread, unsigned int num)
 
static void ignore (unsigned int num)
 
static void handle (unsigned int num, Handler handler)
 

Detailed Description

The class implements working with POSIX signals.

Member Function Documentation

unsigned int PosixSignal::byName ( const std::string &  name)
staticprotected

Translate name of a signal to its internal representation.

void PosixSignal::handle ( const std::string &  name,
Handler  handler 
)
static

Install a handler for the given signal name.

Parameters
nameName of the signal to handle
handlerHandler to be used
static void BeeeOn::PosixSignal::ignore ( const std::string &  name)
static

Ignore the selected signal to not influence the current process (SIG_IGN).

Parameters
nameName of the signal to be ignored
static void BeeeOn::PosixSignal::send ( long  pid,
const std::string  name 
)
static

Send signal to a process of the given pid.

Parameters
pidProcess ID
nameName of the signal to send (e.g. SIGUSR1)
static void BeeeOn::PosixSignal::send ( const Poco::Thread &  thread,
const std::string &  name 
)
static

Send signal to a thread owning by this process. We assume that the Poco::Thread is using pthread internally. The implementation calls pthread_kill() to send the signal to the proper thread.

Parameters
threadThread to send the signal to
nameName of the signal to send
void PosixSignal::trapFatal ( )
static

Install appropriate handlers for the most fatal signals like SIGSEGV, SIGBUS, etc. The application would provide some more information during the actual crash. The handlers terminates the application by calling _exit().


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