mkql_terminator.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #pragma once
  2. #include <util/generic/noncopyable.h>
  3. #include <util/system/compiler.h>
  4. #include <yql/essentials/public/issue/yql_issue.h>
  5. namespace NKikimr {
  6. namespace NMiniKQL {
  7. class TTerminateException : public NYql::TErrorException
  8. {
  9. public:
  10. TTerminateException();
  11. };
  12. ///////////////////////////////////////////////////////////////////////////////
  13. // ITerminator
  14. ///////////////////////////////////////////////////////////////////////////////
  15. class ITerminator
  16. {
  17. public:
  18. virtual ~ITerminator() = default;
  19. virtual void Terminate(const char* message) const = 0;
  20. };
  21. struct TBindTerminator : private TNonCopyable {
  22. TBindTerminator(ITerminator* terminator);
  23. ~TBindTerminator();
  24. static thread_local ITerminator* Terminator;
  25. private:
  26. ITerminator* PreviousTerminator;
  27. };
  28. struct TThrowingBindTerminator : public TBindTerminator, public ITerminator {
  29. TThrowingBindTerminator();
  30. void Terminate(const char* message) const final;
  31. };
  32. struct TOnlyThrowingBindTerminator : public TBindTerminator, public ITerminator {
  33. TOnlyThrowingBindTerminator();
  34. void Terminate(const char* message) const final;
  35. };
  36. [[noreturn]] void MKQLTerminate(const char* message);
  37. }
  38. }