projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
StoreSession: Remove outdated comment
[pulseview.git]
/
signalhandler.cpp
diff --git
a/signalhandler.cpp
b/signalhandler.cpp
index 8c9244b3c269aa32992db7bce55af01e51f9229c..398114d5b96f610954f5c86f8d6b833407a9812b 100644
(file)
--- a/
signalhandler.cpp
+++ b/
signalhandler.cpp
@@
-14,11
+14,10
@@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
*/
-#include "signalhandler.h"
+#include "signalhandler.h
pp
"
#include <assert.h>
#include <signal.h>
#include <assert.h>
#include <signal.h>
@@
-29,11
+28,11
@@
#include <QDebug>
#include <QSocketNotifier>
#include <QDebug>
#include <QSocketNotifier>
-int SignalHandler::
_sockets
[2];
+int SignalHandler::
sockets_
[2];
bool SignalHandler::prepare_signals()
{
bool SignalHandler::prepare_signals()
{
- if
(socketpair(AF_UNIX, SOCK_STREAM, 0, _sockets
) != 0)
+ if
(socketpair(AF_UNIX, SOCK_STREAM, 0, sockets_
) != 0)
return false;
struct sigaction sig_action;
return false;
struct sigaction sig_action;
@@
-42,10
+41,10
@@
bool SignalHandler::prepare_signals()
sigemptyset(&sig_action.sa_mask);
sig_action.sa_flags = SA_RESTART;
sigemptyset(&sig_action.sa_mask);
sig_action.sa_flags = SA_RESTART;
- if
(sigaction(SIGINT, &sig_action, 0
) != 0 ||
- sigaction(SIGTERM, &sig_action,
0
) != 0) {
- close(
_sockets
[0]);
- close(
_sockets
[1]);
+ if
(sigaction(SIGINT, &sig_action, nullptr
) != 0 ||
+ sigaction(SIGTERM, &sig_action,
nullptr
) != 0) {
+ close(
sockets_
[0]);
+ close(
sockets_
[1]);
return false;
}
return false;
}
@@
-53,21
+52,20
@@
bool SignalHandler::prepare_signals()
}
SignalHandler::SignalHandler(QObject* parent) : QObject(parent),
}
SignalHandler::SignalHandler(QObject* parent) : QObject(parent),
-
_socket_notifier(0
)
+
socket_notifier_(nullptr
)
{
{
-
_socket_notifier = new QSocketNotifier(_sockets
[1],
+
socket_notifier_ = new QSocketNotifier(sockets_
[1],
QSocketNotifier::Read, this);
QSocketNotifier::Read, this);
- connect(
_socket_notifier
, SIGNAL(activated(int)),
+ connect(
socket_notifier_
, SIGNAL(activated(int)),
SLOT(on_socket_notifier_activated()));
}
void SignalHandler::on_socket_notifier_activated()
{
SLOT(on_socket_notifier_activated()));
}
void SignalHandler::on_socket_notifier_activated()
{
-
_socket_notifier
->setEnabled(false);
+
socket_notifier_
->setEnabled(false);
int sig_number;
int sig_number;
- if(read(_sockets[1], &sig_number, sizeof(int)) !=
- sizeof(int)) {
+ if (read(sockets_[1], &sig_number, sizeof(int)) != sizeof(int)) {
qDebug() << "Failed to catch signal";
abort();
}
qDebug() << "Failed to catch signal";
abort();
}
@@
-75,20
+73,19
@@
void SignalHandler::on_socket_notifier_activated()
switch(sig_number)
{
case SIGINT:
switch(sig_number)
{
case SIGINT:
-
emit
int_received();
+
Q_EMIT
int_received();
break;
case SIGTERM:
break;
case SIGTERM:
-
emit
term_received();
+
Q_EMIT
term_received();
break;
}
break;
}
-
_socket_notifier
->setEnabled(true);
+
socket_notifier_
->setEnabled(true);
}
void SignalHandler::handle_signals(int sig_number)
{
}
void SignalHandler::handle_signals(int sig_number)
{
- if(write(_sockets[0], &sig_number, sizeof(int)) !=
- sizeof(int)) {
+ if (write(sockets_[0], &sig_number, sizeof(int)) != sizeof(int)) {
// Failed to handle signal
abort();
}
// Failed to handle signal
abort();
}