2
0
mirror of https://github.com/boostorg/thread.git synced 2026-01-24 18:32:32 +00:00
Files
thread/test/test_6130.cpp
2012-01-07 20:52:57 +00:00

23 lines
605 B
C++

#include <boost/thread.hpp>
#include <assert.h>
#include <iostream>
#include <stdlib.h>
#include <unistd.h>
boost::mutex mtx;
boost::condition_variable cv;
int main()
{
for (int i=0; i<3; ++i) {
const time_t wait_time = ::time(0)+1;
boost::mutex::scoped_lock lk(mtx);
const bool res = cv.timed_wait(lk, boost::posix_time::from_time_t(wait_time));
const time_t end_time = ::time(0);
assert(end_time >= wait_time);
std::cerr << end_time - wait_time << " OK\n";
}
return 0;
}