1 #ifndef ZTH_CONTEXT_UCONTEXT_H 
    2 #define ZTH_CONTEXT_UCONTEXT_H 
   12 #ifndef ZTH_CONTEXT_CONTEXT_H 
   13 #       error This file must be included by libzth/context/context.h. 
   20 #               ifndef _XOPEN_SOURCE 
   21 #                       error Please define _XOPEN_SOURCE before including headers. 
   32 #       pragma GCC diagnostic push 
   33 #       pragma GCC diagnostic ignored "-Wdeprecated-declarations"  
   34 class Context : 
public impl::ContextArch<Context> {
 
   45         static void context_trampoline(
Context* context, sigjmp_buf origin)
 
   49 #       ifdef ZTH_ENABLE_ASAN 
   50                 void const* oldstack = 
nullptr;
 
   52                 __sanitizer_finish_switch_fiber(
nullptr, &oldstack, &oldsize);
 
   55                 __sanitizer_start_switch_fiber(
nullptr, oldstack, oldsize);
 
   60                         siglongjmp(origin, 1);
 
   85                 uc.uc_stack.ss_sp = stack_.
p;
 
   86                 uc.uc_stack.ss_size = stack_.
size;
 
   91                         &uc, 
reinterpret_cast<void (*)(
void)
>(&context_trampoline), 2, 
this,
 
   94 #       ifdef ZTH_ENABLE_ASAN 
   95                 void* fake_stack = 
nullptr;
 
   96                 __sanitizer_start_switch_fiber(&fake_stack, stack_.
p, stack_.
size);
 
  109 #       ifdef ZTH_ENABLE_ASAN 
  110                 __sanitizer_finish_switch_fiber(fake_stack, 
nullptr, 
nullptr);
 
  119                         siglongjmp(to.m_env, 1);
 
  125 #       pragma GCC diagnostic pop 
impl::ContextArch< Context > base
 
void context_switch(Context &to) noexcept
 
constexpr Context(ContextAttr const &attr) noexcept
 
Stack const  & stack() const noexcept
Return the stack address.
 
int create() noexcept
Create context.
 
ContextAttr & attr() noexcept
Return the context attributes, requested by the user.
 
Stack const  & stackUsable() const noexcept
Return the start of the actual usable stack.
 
#define ZTH_CLASS_NEW_DELETE(T)
Define new/delete operators for a class, which are allocator-aware.
 
void context_entry(Context *context)
 
static bool const ContextSignals
Take POSIX signal into account when doing a context switch.
 
#define unlikely(expr)
Marks the given expression to likely be evaluated to true.