aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/minikql/mkql_terminator.h
blob: a3655e3b574952797648c98f8a09798534890566 (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
35
36
37
38
39
40
41
42
43
44
45
#pragma once

#include <util/generic/noncopyable.h>
#include <util/system/compiler.h>


namespace NKikimr {

namespace NMiniKQL {
///////////////////////////////////////////////////////////////////////////////
// ITerminator
///////////////////////////////////////////////////////////////////////////////
class ITerminator
{
public:
    virtual ~ITerminator() = default;
    virtual void Terminate(const char* message) const = 0;
};

struct TBindTerminator : private TNonCopyable {
    TBindTerminator(ITerminator* terminator);
    ~TBindTerminator();

    static thread_local ITerminator* Terminator;
private:
    ITerminator* PreviousTerminator;
};

struct TThrowingBindTerminator : public TBindTerminator, public ITerminator {
    TThrowingBindTerminator();
    void Terminate(const char* message) const final;
};

struct TOnlyThrowingBindTerminator : public TBindTerminator, public ITerminator {
    TOnlyThrowingBindTerminator();
    void Terminate(const char* message) const final;
};



[[noreturn]] void MKQLTerminate(const char* message);

}

}