Skip to content

Instantly share code, notes, and snippets.

@dloman
Created October 25, 2017 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dloman/cd1d1109071a11ee48e40c12bf914810 to your computer and use it in GitHub Desktop.
Save dloman/cd1d1109071a11ee48e40c12bf914810 to your computer and use it in GitHub Desktop.
std::mutex Mutex;
std::condition_variable cv;
std::unique_lock<std::mutex> Lock(Mutex);
for (auto i = 0; i < 10; ++i)
{
auto a = cv.wait_for(Lock, std::chrono::milliseconds(10));
if (a == std::cv_status::no_timeout)
{
return 1;
}
}
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment