From bd33413833d411a09b06db4e57026f1c94f83069 Mon Sep 17 00:00:00 2001 From: Alberto Miranda Date: Mon, 17 Oct 2022 14:09:15 +0200 Subject: [PATCH] job_manager: Use std::shared_mutex instead of abt::shared_mutex --- src/scord/job_manager.hpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/scord/job_manager.hpp b/src/scord/job_manager.hpp index 2f97d0f9..45d7d493 100644 --- a/src/scord/job_manager.hpp +++ b/src/scord/job_manager.hpp @@ -30,8 +30,6 @@ #include #include #include -#include -#include #include #include #include @@ -72,11 +70,11 @@ struct job_manager : scord::utils::singleton { create(admire::slurm_job_id slurm_id, admire::job::resources job_resources, admire::job_requirements job_requirements) { - abt::unique_lock lock(m_jobs_mutex); - static std::atomic_uint64_t current_id; admire::job_id id = current_id++; + abt::unique_lock lock(m_jobs_mutex); + if(const auto it = m_jobs.find(id); it == m_jobs.end()) { const auto& [it_job, inserted] = m_jobs.emplace(id, job_info{admire::job{id, slurm_id}, @@ -146,7 +144,7 @@ private: friend class scord::utils::singleton; job_manager() = default; - mutable std::shared_mutex m_jobs_mutex; + mutable abt::shared_mutex m_jobs_mutex; std::unordered_map m_jobs; }; -- GitLab