From fe2baedc760c2f29e2c720f6b1132a2de33c5430 Mon Sep 17 00:00:00 2001 From: Mel Date: Sat, 8 Jul 2023 03:25:44 +0200 Subject: Use own size types --- src/Compute/Queue.hpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/Compute') diff --git a/src/Compute/Queue.hpp b/src/Compute/Queue.hpp index 77aed7f..4035d56 100644 --- a/src/Compute/Queue.hpp +++ b/src/Compute/Queue.hpp @@ -1,7 +1,7 @@ #pragma once +#include "../Common/Sizes.hpp" #include -#include #include #include #include @@ -9,17 +9,17 @@ namespace MC::Compute { -template +template class Queue { public: - explicit Queue(uint workers) : m_control(std::make_shared()) { - for (uint w = 0; w < workers; w++) { + explicit Queue(UInt workers) : m_control(std::make_shared()) { + for (UInt w = 0; w < workers; w++) { std::thread thread{[=]{ Queue::run_thread(m_control); }}; thread.detach(); } } - void add(I id, float priority, std::function execute) { + void add(I id, Real priority, std::function execute) { std::scoped_lock work_lock(m_control->work.mutex); m_control->work.jobs.emplace(id, priority, execute); } @@ -43,13 +43,13 @@ public: private: struct Job { Job() = default; - Job(I id, float priority, std::function execute) : id(id), priority(priority), execute(execute) {} + Job(I id, Real priority, std::function execute) : id(id), priority(priority), execute(execute) {} I id; - float priority; + Real priority; std::function execute; - bool operator>(const Job& other) const { return priority > other.priority; } + Bool operator>(const Job& other) const { return priority > other.priority; } }; struct Work { @@ -71,7 +71,7 @@ private: using namespace std::chrono_literals; while (true) { - bool nothing_to_do = true; + Bool nothing_to_do = true; Job job; { std::scoped_lock work_lock(control->work.mutex); -- cgit 1.4.1