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

#include <util/system/yassert.h> 
 
void TAtomicShutdownState::ShutdownCommand() {
    Y_VERIFY(State.CompareAndSet(SS_RUNNING, SS_SHUTDOWN_COMMAND));
} 
 
void TAtomicShutdownState::CompleteShutdown() {
    Y_VERIFY(State.CompareAndSet(SS_SHUTDOWN_COMMAND, SS_SHUTDOWN_COMPLETE));
    ShutdownComplete.Signal(); 
} 
 
bool TAtomicShutdownState::IsRunning() {
    return State.Get() == SS_RUNNING; 
} 
 
TAtomicShutdownState::~TAtomicShutdownState() {
    Y_VERIFY(SS_SHUTDOWN_COMPLETE == State.Get());
}