I have a condition variable std::condition_variable my_cond;
I want to be able to replace boost::timed_wait()
with an std equivalent one.
If the previously mentioned condition variable was a boost one, then I would use the boost version of timed_wait()
like this: cond_.timed_wait(lock,timeout);
where lock
is std::scoped_lock lock(mutex_);
and timeout is a time that is performed with boost::chrono
.
boost:chrono
, boost locks
and boost mutexes
have been replaced with their std analogues. I have yet to find an alternative to timed_wait()
.
I try to find a function belonging to std, where it receives the lock as the first parameter and an std::chrono
type time as a second parameter. Looking at the documentation of the condition_variable::wait
here: https://en.cppreference.com/w/cpp/thread/condition_variable/wait
I don't see an overloaded wait function where the second argument is a time type.
Is this conversion from boost::timed_wait()
to std::wait()
possible?
Aucun commentaire:
Enregistrer un commentaire