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/executor.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 lib/executor.h (limited to 'lib/executor.h') diff --git a/lib/executor.h b/lib/executor.h new file mode 100644 index 0000000..5d2e5b6 --- /dev/null +++ b/lib/executor.h @@ -0,0 +1,27 @@ +/* Copyright (c) 2020 Johannes Stoelp */ + +#pragma once + +#include "thread.h" + +#include +#include + +namespace nMatcha { + struct Executor { + Executor(const Executor&) = delete; + Executor& operator=(const Executor&) = delete; + Executor() = default; + + const void* getStackPtr() const { return mStackPtr; } + + void spawn(std::unique_ptr t); + void run(); + + private: + void* mStackPtr; + std::vector> mThreads; + + void yield_to(const Thread* t) const; + }; +} // namespace nMatcha -- cgit v1.2.3