Skip to content
Snippets Groups Projects
Commit 5ce456e4 authored by Serguei Kolos's avatar Serguei Kolos
Browse files

Rename 'signals' parameter to avoid clash with Qt #define

parent 1e4592f7
No related branches found
Tags ipc-05-14-08
No related merge requests found
......@@ -17,18 +17,17 @@ namespace daq
namespace ipc
{
/*! \brief This class can be used for blocking a thread until a signal is received.
* *
* \ingroup public
*/
class signal
{
public:
static int wait_for(
std::vector<int> const& signals = {SIGINT, SIGTERM},
std::vector<int> const& signums = {SIGINT, SIGTERM},
uint32_t precision_ms = 1000) noexcept;
static int raise(int sig = SIGTERM) {
return ::raise(sig);
static int raise(int signum = SIGTERM) {
return ::raise(signum);
}
private:
......
......@@ -17,11 +17,11 @@ typedef void (*SignalHandler)(int);
volatile std::sig_atomic_t signal::m_signal;
int signal::wait_for(std::vector<int> const& signals,
int signal::wait_for(std::vector<int> const& signums,
uint32_t precision_ms) noexcept
{
std::map<int, SignalHandler> old_handlers;
for (auto it = signals.begin(); it != signals.end(); ++it) {
for (auto it = signums.begin(); it != signums.end(); ++it) {
SignalHandler sh = std::signal(*it, signalHandler);
if (sh != SIG_ERR) {
old_handlers[*it] = sh;
......@@ -41,7 +41,7 @@ int signal::wait_for(std::vector<int> const& signals,
return m_signal;
}
void signal::signalHandler(int sig)
void signal::signalHandler(int signum)
{
m_signal = sig;
m_signal = signum;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment