From 33f286000db35fe50639c237caa736deea304585 Mon Sep 17 00:00:00 2001 From: johannst Date: Tue, 22 Sep 2020 23:48:09 +0200 Subject: split classes into separate files, add arch specific subdir --- example/demo1.cc | 33 +++++++++++++++++++++++++++++++++ example/test.cc | 32 -------------------------------- 2 files changed, 33 insertions(+), 32 deletions(-) create mode 100644 example/demo1.cc delete mode 100644 example/test.cc (limited to 'example') diff --git a/example/demo1.cc b/example/demo1.cc new file mode 100644 index 0000000..1c910cd --- /dev/null +++ b/example/demo1.cc @@ -0,0 +1,33 @@ +/* Copyright (c) 2020 Johannes Stoelp */ + +#include "lib/executor.h" +#include "lib/thread.h" + +#include +#include + +struct TestThread : public nMatcha::Thread { + TestThread(const char* name) : Thread(), mName(name) {} + + virtual void threadFn() override { + printf("[%s] starting up TestThread -> yield()\n", mName); + yield(); + printf("[%s] yield() -> finishing TestThreads\n", mName); + } + + private: + const char* mName; +}; + +int main() { + puts("[main] start main thread"); + + nMatcha::Executor e; + e.spawn(std::make_unique("Thread1")); + e.spawn(std::make_unique("Thread2")); + e.spawn(std::make_unique("Thread3")); + e.run(); + + puts("[main] finish main thread"); + return 0; +} diff --git a/example/test.cc b/example/test.cc deleted file mode 100644 index c9691f3..0000000 --- a/example/test.cc +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (c) 2020 Johannes Stoelp */ - -#include "lib/matcha.h" - -#include -#include - -struct TestThread : public Thread { - TestThread(const char* name) : Thread(), mName(name) {} - - virtual void threadFn() override { - printf("[%s] starting up TestThread -> yield()\n", mName); - yield(); - printf("[%s] yield() -> finishing TestThreads\n", mName); - } - - private: - const char* mName; -}; - -int main() { - puts("[main] start main thread"); - - Executor e; - e.spawn(std::make_unique("Thread1")); - e.spawn(std::make_unique("Thread2")); - e.spawn(std::make_unique("Thread3")); - e.run(); - - puts("[main] finish main thread"); - return 0; -} -- cgit v1.2.3