blob: 8fe7665865f303c9d7f82509d10c46b020f513b4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "sigterm.h"
#include <vespa/vespalib/util/signalhandler.h>
void hook_signals()
{
vespalib::SignalHandler::INT.hook();
vespalib::SignalHandler::TERM.hook();
vespalib::SignalHandler::PIPE.ignore();
}
bool gotSignaled()
{
return (vespalib::SignalHandler::INT.check() ||
vespalib::SignalHandler::TERM.check());
}
int gotSignalNumber()
{
if (vespalib::SignalHandler::TERM.check()) {
return SIGTERM;
}
if (vespalib::SignalHandler::INT.check()) {
return SIGINT;
}
return 0;
}
|