main.cpp 678 Bytes
Newer Older
1
#include <utility>
2
#include <cstdio>
3 4

#include "context_switcher/context_switcher.h"
5 6 7
using namespace context_switcher;
using namespace std;

8
// Memory for custom stack and continuation semantics
9
const size_t STACK_SIZE = 512 * 32;
10
const size_t NUM_STACKS = 4;
11
char custom_stacks[NUM_STACKS][STACK_SIZE];
12

13
volatile int result;
14

15
int main() {
16 17 18 19
  while (true) {
    context_switcher::continuation cont = enter_context(custom_stacks[0], STACK_SIZE, [](continuation &&main_cont) {
//      main_cont = context_switcher::switch_context(std::move(main_cont));
      return std::move(main_cont);
20
    });
21

22 23
//    cont = context_switcher::switch_context(std::move(cont));
  };
24

25
  return 0;
26
}