diff options
Diffstat (limited to 'lib/thread.h')
-rw-r--r-- | lib/thread.h | 26 |
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 |