aboutsummaryrefslogblamecommitdiff
path: root/example/test.cc
blob: b43670814cd57b66e6b3ca68422c99ce3d0f2007 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12




                       






                                                       



                              
                        



                               
#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;
}