Zth (libzth)
stack

Functions

template<typename R , typename... A, typename... A_>
std::enable_if<!std::is_void< R >::value, R >::type zth::stack_switch (void *stack, size_t size, R(*f)(A...) noexcept, A_ &&... a) noexcept
 Call the function f using the new stack pointer. More...
 
template<typename... A, typename... A_>
void zth::stack_switch (void *stack, size_t size, void(*f)(A...) noexcept, A_ &&... a) noexcept
 Call the function f using the new stack pointer. More...
 
void zth::stack_watermark_init (void *stack, size_t size) noexcept
 Initialize the memory region for stack high water marking. More...
 
size_t zth::stack_watermark_size (void *stack) noexcept
 Return the size of the given stack region. More...
 
size_t zth::stack_watermark_maxused (void *stack) noexcept
 Return the high water mark of the stack. More...
 
size_t zth::stack_watermark_remaining (void *stack) noexcept
 Return the remaining stack size that was never touched. More...
 

Detailed Description

Function Documentation

◆ stack_switch() [1/2]

template<typename R , typename... A, typename... A_>
std::enable_if<!std::is_void<R>::value, R>::type zth::stack_switch ( void *  stack,
size_t  size,
R(*)(A...) noexcept  f,
A_ &&...  a 
)
inlinenoexcept

Call the function f using the new stack pointer.

Type-safe C++ wrapper for zth_stack_switch().

Examples
6_stack.cpp.

Definition at line 414 of file context.h.

◆ stack_switch() [2/2]

template<typename... A, typename... A_>
void zth::stack_switch ( void *  stack,
size_t  size,
void(*)(A...) noexcept  f,
A_ &&...  a 
)
inlinenoexcept

Call the function f using the new stack pointer.

Type-safe C++ wrapper for zth_stack_switch().

Definition at line 428 of file context.h.

◆ stack_watermark_init()

void zth::stack_watermark_init ( void *  stack,
size_t  size 
)
noexcept

Initialize the memory region for stack high water marking.

Examples
6_stack.cpp.

Definition at line 245 of file context.cpp.

◆ stack_watermark_maxused()

size_t zth::stack_watermark_maxused ( void *  stack)
noexcept

Return the high water mark of the stack.

This does not take any zth::stack_switch() calls into account.

Parameters
stackthe same value as supplied to zth::stack_watermark_init
Examples
6_stack.cpp.

Definition at line 283 of file context.cpp.

◆ stack_watermark_remaining()

size_t zth::stack_watermark_remaining ( void *  stack)
noexcept

Return the remaining stack size that was never touched.

This does not take any zth::stack_switch() calls into account.

Parameters
stackthe same value as supplied to zth::stack_watermark_init

Definition at line 315 of file context.cpp.

◆ stack_watermark_size()

size_t zth::stack_watermark_size ( void *  stack)
noexcept

Return the size of the given stack region.

This does not take any zth::stack_switch() calls into account.

Parameters
stackthe same value as supplied to zth::stack_watermark_init

Definition at line 267 of file context.cpp.