aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/util/sig_catch.cpp
blob: e73dc10c2b0c5aa3c8e27216cb25cff79a1b9040 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "sig_catch.h"
#include "signalhandler.h"

namespace vespalib {

SigCatch::SigCatch()
{
    SignalHandler::PIPE.ignore();
    SignalHandler::INT.hook();
    SignalHandler::TERM.hook();
}

bool
SigCatch::receivedStopSignal()
{
    return (SignalHandler::INT.check() ||
            SignalHandler::TERM.check());
}

} // namespace vespalib