aboutsummaryrefslogtreecommitdiffstats
path: root/fnet/src/vespa/fnet/signalshutdown.h
blob: 21b96fdcce914faa6a8940a3be28e593381377cf (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "task.h"

class FNET_Transport;
/**
 * Utility class that will shut down a transport when the process gets
 * either INT or TERM.
 **/
class FNET_SignalShutDown : FNET_Task
{
private:
    FNET_Transport &_transport;

public:
    FNET_SignalShutDown(FNET_Transport &t);
    void PerformTask() override;

    /**
     * Set up signal handling to hook appropriate signals.
     **/
    static void hookSignals();
};