summaryrefslogtreecommitdiffstats
path: root/include/framework/scheduling
diff options
context:
space:
mode:
Diffstat (limited to 'include/framework/scheduling')
-rw-r--r--include/framework/scheduling/FIFOScheduler.h2
-rw-r--r--include/framework/scheduling/Version.h9
2 files changed, 5 insertions, 6 deletions
diff --git a/include/framework/scheduling/FIFOScheduler.h b/include/framework/scheduling/FIFOScheduler.h
index 7cb6d20..4c1db8d 100644
--- a/include/framework/scheduling/FIFOScheduler.h
+++ b/include/framework/scheduling/FIFOScheduler.h
@@ -82,6 +82,7 @@ private:
std::atomic<size_t> m_counter;
std::mutex m_cv_lock;
std::condition_variable m_cv;
+ std::mutex m_queue_lock;
std::thread m_sched_thrd;
std::thread m_sched_wakeup_thrd;
@@ -102,6 +103,7 @@ private:
}
void schedule_next() {
+ auto lk = std::unique_lock<std::mutex>(m_queue_lock);
assert(m_task_queue.size() > 0);
auto t = m_task_queue.pop();
m_stats.job_scheduled(t.m_timestamp);
diff --git a/include/framework/scheduling/Version.h b/include/framework/scheduling/Version.h
index 8d3d038..9c62ea1 100644
--- a/include/framework/scheduling/Version.h
+++ b/include/framework/scheduling/Version.h
@@ -84,13 +84,10 @@ public:
return version;
}
- void set_next_buffer_head(size_t new_head) {
- m_pending_buffer_head = new_head;
- }
-
bool advance_buffer_head() {
- m_buffer_head = m_pending_buffer_head;
- return m_buffer->advance_head(m_buffer_head);
+ auto new_head = m_buffer->get_buffer_view().get_tail();
+ m_buffer_head = new_head;
+ return m_buffer->advance_head(new_head);
}
private: