aboutsummaryrefslogtreecommitdiff
path: root/lib/thread.h
diff options
context:
space:
mode:
authorjohannst <johannes.stoelp@gmail.com>2020-09-22 23:48:09 +0200
committerjohannst <johannes.stoelp@gmail.com>2020-09-22 23:48:09 +0200
commit33f286000db35fe50639c237caa736deea304585 (patch)
treeddb74ebd1f626b200cbb5050545ded484dde4787 /lib/thread.h
parent488d4c6237c3f713077fe93e2745ba5defde0aa5 (diff)
downloadmatcha-threads-33f286000db35fe50639c237caa736deea304585.tar.gz
matcha-threads-33f286000db35fe50639c237caa736deea304585.zip
split classes into separate files, add arch specific subdir
Diffstat (limited to 'lib/thread.h')
-rw-r--r--lib/thread.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/thread.h b/lib/thread.h
new file mode 100644
index 0000000..e392052
--- /dev/null
+++ b/lib/thread.h
@@ -0,0 +1,26 @@
+/* Copyright (c) 2020 Johannes Stoelp */
+
+#pragma once
+
+namespace nMatcha {
+ struct Executor;
+
+ struct Thread {
+ Thread(const Thread&) = delete;
+ Thread& operator=(const Thread&) = delete;
+ Thread();
+ virtual ~Thread() {}
+
+ virtual void threadFn() = 0;
+
+ protected:
+ void yield();
+
+ private:
+ static void entry(void* obj);
+ void* mStackPtr;
+
+ friend struct Executor;
+ const Executor* mExecutor;
+ };
+} // namespace nMatcha