I am new to std::thread
. I need to put a std::thread
to sleep from another thread, is that possible? In examples, all I see is code like:
std::this_thread::sleep_for(std::chrono::seconds(1));
But what I want to do is something like:
std::thread t([]{...});
t.sleep(std::chrono::seconds(1));
or
sleep(t, std::chrono::seconds(1));
Any ideas?
std::condition_variable
and its methods likewait(...)
orwait_for(...)
– Endoderm