summaryrefslogtreecommitdiffstats
path: root/include/framework
diff options
context:
space:
mode:
authorDouglas Rumbaugh <dbr4@psu.edu>2023-10-30 14:47:16 -0400
committerDouglas Rumbaugh <dbr4@psu.edu>2023-10-30 14:47:16 -0400
commit40b87b74f2bf4e93fdc9dabd6eab9175187fb63c (patch)
treef0d21861120d7ba2d044ec8bc951cefcd013371c /include/framework
parentceffd8caf5e4e827e2cc4d6975507a66d88f77a9 (diff)
downloaddynamic-extension-40b87b74f2bf4e93fdc9dabd6eab9175187fb63c.tar.gz
FIFOScheduler: correctly protect m_cv with a lock
Diffstat (limited to 'include/framework')
-rw-r--r--include/framework/scheduling/FIFOScheduler.h5
1 files changed, 5 insertions, 0 deletions
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<std::mutex> lk(m_cv_lock);
m_cv.notify_all();
+ lk.release();
+
m_sched_thrd.join();
}
void schedule_job(std::function<void(void*)> 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<std::mutex> lk(m_cv_lock);
m_cv.notify_all();
}