aboutsummaryrefslogtreecommitdiff
path: root/lib/executor.cc
diff options
context:
space:
mode:
authorjohannst <johannes.stoelp@gmail.com>2020-09-29 02:06:41 +0200
committerjohannst <johannes.stoelp@gmail.com>2020-09-29 02:06:41 +0200
commitfc83627b14536d0b13b2dd751d09cecbea9db378 (patch)
tree68d42350261fb7769615ceaa8af4187eb2dc571e /lib/executor.cc
parent38d7af6768871a5d285e776bbcfe18b6e7440cfb (diff)
downloadmatcha-threads-fc83627b14536d0b13b2dd751d09cecbea9db378.tar.gz
matcha-threads-fc83627b14536d0b13b2dd751d09cecbea9db378.zip
move thread init into arch/
Diffstat (limited to 'lib/executor.cc')
-rw-r--r--lib/executor.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/executor.cc b/lib/executor.cc
index 8977ee3..175d7a5 100644
--- a/lib/executor.cc
+++ b/lib/executor.cc
@@ -2,7 +2,7 @@
#include "executor.h"
-#include "arch/x86_64/asm.h"
+#include "arch/x86_64/api.h"
namespace nMatcha {
void Executor::spawn(std::unique_ptr<Thread> t) {
@@ -11,13 +11,13 @@ namespace nMatcha {
}
void Executor::run() {
+ // Round robin until all threads finished.
while (!mThreads.empty()) {
for (const std::unique_ptr<Thread>& t : mThreads) {
if (!t->isFinished()) {
yield_to(t.get());
}
}
-
mThreads.remove_if([](const std::unique_ptr<Thread>& t) { return t->isFinished(); });
}
}