aboutsummaryrefslogtreecommitdiff
path: root/example/test.cc
blob: b43670814cd57b66e6b3ca68422c99ce3d0f2007 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "lib/matcha.h"

#include <cassert>
#include <cstdio>

struct Thread1 : public Thread {
    virtual void threadFn() override {
        puts("start threadFn -> yield()");
        yield();
        puts("return from yield() -> finish threadFn");
    }
} gThread1;

int main() {
    puts("start main thread");

    gThread1.yield_to();

    puts("finish main thread");
    return 0;
}