#include #include #include "context_switcher/context_switcher.h" // Memory for custom stack and continuation semantics const size_t STACK_SIZE = 512 * 8; char custom_stack_1[STACK_SIZE]; // Force disable optimization volatile int value = 0; int main() { using namespace context_switcher; printf("Main 1!\n"); auto cont_2 = enter_context(custom_stack_1, STACK_SIZE, [](continuation &&cont_main) { printf("Stack 1!\n"); cont_main = switch_context(std::move(cont_main)); printf("Stack 2!\n"); return std::move(cont_main); }); printf("Main 2!\n"); cont_2 = switch_context(std::move(cont_2)); printf("Main 3!\n"); return 0; }