#include "coroutine.hpp"
#include <iostream>

using namespace std;
using namespace tinyrpc;

Coroutine* co1;
Coroutine* co2;

void coro1() {

    cout << "this is coro1 begin" << endl;

    Coroutine::yeild();

    cout << "this is coro1 end" << endl;

}

void coro2() {

    cout << "this is coro2 begin" << endl;

    Coroutine::yeild();

    cout << "this is coro2 end" << endl;

}


int main() {
    int stk_size = 4 * 1024 * 1024;
    // char* stk1 = static_cast<char*>(malloc(stk_size));
    // char* stk2 = static_cast<char*>(malloc(stk_size));
    co1 = new Coroutine(stk_size, coro1);
    co2 = new Coroutine(stk_size, coro2);
    co1->resume();
    co2->resume();
    co1->resume();
    co2->resume();
}



