24 template <
typename... Args>
25 auto operator()(Args &&...args) ->
decltype(func(std::forward<Args>(args)...)) {
28 ::ErrorContextCallback *cb;
30 ::MemoryContext mcxt = ::CurrentMemoryContext;
32 pbuf = ::PG_exception_stack;
33 cb = ::error_context_stack;
34 ::PG_exception_stack = &buf;
37 std::shared_ptr<void> defer(
nullptr, [&](...) {
38 ::error_context_stack = cb;
39 ::PG_exception_stack = pbuf;
42 state = sigsetjmp(buf, 1);
45 return func(std::forward<Args>(args)...);
46 }
else if (state == 1) {
49 __builtin_unreachable();
53template <
typename Func>
auto ffi_guarded(Func f) {
return ffi_guard<Func>{f}; }
Definition: exception.hpp:7