From 40b87b74f2bf4e93fdc9dabd6eab9175187fb63c Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Mon, 30 Oct 2023 14:47:16 -0400 Subject: FIFOScheduler: correctly protect m_cv with a lock --- include/framework/scheduling/FIFOScheduler.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/framework/scheduling') diff --git a/include/framework/scheduling/FIFOScheduler.h b/include/framework/scheduling/FIFOScheduler.h index 878bb81..7ccab26 100644 --- a/include/framework/scheduling/FIFOScheduler.h +++ b/include/framework/scheduling/FIFOScheduler.h @@ -44,13 +44,18 @@ public: ~FIFOScheduler() { shutdown(); + std::unique_lock lk(m_cv_lock); m_cv.notify_all(); + lk.release(); + m_sched_thrd.join(); } void schedule_job(std::function job, size_t size, void *args) { size_t ts = m_counter.fetch_add(1); m_task_queue.push(Task(size, ts, job, args)); + + std::unique_lock lk(m_cv_lock); m_cv.notify_all(); } -- cgit v1.2.3