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 --- lib/thread.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 lib/thread.h (limited to 'lib/thread.h') 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 -- cgit v1.2.3