mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-06-26 07:02:59 +00:00
Move signal handler after the constructor
This commit is contained in:
parent
0da7fc6704
commit
707c7826fb
@ -81,33 +81,6 @@ extern Concurrent_Queue<Gps_Acq_Assist> global_gps_acq_assist_queue;
|
|||||||
|
|
||||||
ControlThread *ControlThread::me = nullptr;
|
ControlThread *ControlThread::me = nullptr;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Callback function for handling signals.
|
|
||||||
* \param sig identifier of signal
|
|
||||||
*/
|
|
||||||
void ControlThread::handle_signal(int sig)
|
|
||||||
{
|
|
||||||
LOG(INFO) << "GNSS-SDR received " << sig << " OS signal";
|
|
||||||
if (sig == SIGINT || sig == SIGTERM || sig == SIGHUP)
|
|
||||||
{
|
|
||||||
ControlThread::me->control_queue_->push(pmt::make_any(command_event_make(200, 0)));
|
|
||||||
ControlThread::me->stop_ = true;
|
|
||||||
|
|
||||||
// Reset signal handling to default behavior
|
|
||||||
if (sig == SIGINT)
|
|
||||||
{
|
|
||||||
signal(SIGINT, SIG_DFL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (sig == SIGCHLD)
|
|
||||||
{
|
|
||||||
LOG(INFO) << "Received SIGCHLD signal";
|
|
||||||
// todo
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ControlThread::ControlThread()
|
ControlThread::ControlThread()
|
||||||
{
|
{
|
||||||
ControlThread::me = this;
|
ControlThread::me = this;
|
||||||
@ -302,6 +275,28 @@ ControlThread::~ControlThread() // NOLINT(modernize-use-equals-default)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ControlThread::handle_signal(int sig)
|
||||||
|
{
|
||||||
|
LOG(INFO) << "GNSS-SDR received " << sig << " OS signal";
|
||||||
|
if (sig == SIGINT || sig == SIGTERM || sig == SIGHUP)
|
||||||
|
{
|
||||||
|
ControlThread::me->control_queue_->push(pmt::make_any(command_event_make(200, 0)));
|
||||||
|
ControlThread::me->stop_ = true;
|
||||||
|
|
||||||
|
// Reset signal handling to default behavior
|
||||||
|
if (sig == SIGINT)
|
||||||
|
{
|
||||||
|
signal(SIGINT, SIG_DFL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (sig == SIGCHLD)
|
||||||
|
{
|
||||||
|
LOG(INFO) << "Received SIGCHLD signal";
|
||||||
|
// todo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ControlThread::telecommand_listener()
|
void ControlThread::telecommand_listener()
|
||||||
{
|
{
|
||||||
if (telecommand_enabled_)
|
if (telecommand_enabled_)
|
||||||
|
@ -124,6 +124,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/*
|
||||||
|
* Callback function for handling signals.
|
||||||
|
* sig identifier of signal
|
||||||
|
*/
|
||||||
static void handle_signal(int sig);
|
static void handle_signal(int sig);
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user