From 1146362559a06e42fd5db1db797faa729ee6ac86 Mon Sep 17 00:00:00 2001 From: Tom Date: Mon, 16 Sep 2019 18:07:20 +0200 Subject: [PATCH] AtomicCondition::wait_for: use std::chrono::duration --- include/sgnl/AtomicCondition.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/sgnl/AtomicCondition.h b/include/sgnl/AtomicCondition.h index 4d0a016..0835efd 100644 --- a/include/sgnl/AtomicCondition.h +++ b/include/sgnl/AtomicCondition.h @@ -33,11 +33,12 @@ public: this->value_.store(val); } - void wait_for(const std::chrono::milliseconds& time, ValueType val) const + template + void wait_for(const std::chrono::duration& time, + ValueType val) const { std::unique_lock lock(this->condvar_mutex_); - // This while-loop takes care of "spurious wakeups" while( this->value_.load() != val ) if( this->condvar_.wait_for(lock, time) == std::cv_status::timeout ) return;