Skip to content
Snippets Groups Projects
Commit a0c94d97 authored by j2-tulloch's avatar j2-tulloch :speech_balloon:
Browse files

Upload New File

parent 5471fe7b
No related branches found
No related tags found
No related merge requests found
#include <iostream>
#include "scheduler.h"
scheduler s;
int main() {
auto lambda1 = [](void* arg) {
fiber* f = static_cast<fiber*>(arg);
std::cout << "fiber 1 before" << std::endl;
f->finish();
f->yield();
std::cout << "fiber 1 after" << std::endl;
s.fiber_exit();
};
auto lambda2 = [](void* arg) {
fiber* f = static_cast<fiber*>(arg);
std::cout << "fiber 2" << std::endl;
f->finish();
s.fiber_exit();
};
fiber f1(lambda1, &f1);
fiber f2(lambda2, &f2);
s.spawn(&f1);
s.spawn(&f2);
s.do_it();
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment