aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/shutdown_state.h
blob: 86bd7110ae509bab0ee76ec1500149959b83e49f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#pragma once

#include "misc/atomic_box.h"

#include <util/system/event.h>

enum EShutdownState {
    SS_RUNNING,
    SS_SHUTDOWN_COMMAND,
    SS_SHUTDOWN_COMPLETE,
};

struct TAtomicShutdownState {
    TAtomicBox<EShutdownState> State;
    TSystemEvent ShutdownComplete;

    void ShutdownCommand();
    void CompleteShutdown();
    bool IsRunning();

    ~TAtomicShutdownState();
};