aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/utils/signals/signals.h
blob: 612f906207238c61318fc397cd24537cd96ab696 (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
28
29
30
31
32
33
34
#pragma once

#include <util/system/defaults.h>
#include <util/system/sigset.h>
#include <util/system/pipe.h>

#include <signal.h>


namespace NYql {

#ifdef _win_
using sig_atomic_t = int;
#endif

extern volatile sig_atomic_t NeedTerminate;
extern volatile sig_atomic_t NeedQuit;
extern volatile sig_atomic_t NeedReconfigure;
extern volatile sig_atomic_t NeedReopenLog;
extern volatile sig_atomic_t NeedReapZombies;
extern volatile sig_atomic_t NeedInterrupt;

extern TPipe SignalPipeW;
extern TPipe SignalPipeR;

void InitSignals();
void InitSignalsWithSelfPipe();
void CatchInterruptSignal(bool doCatch);

void SigSuspend(const sigset_t* mask);
void AllowAnySignals();
bool HasPendingQuitOrTerm();

} // namespace NYql