コード例 #1
0
void f2()
{
    time_point t0 = Clock::now();
    assert(m.try_lock_until(Clock::now() + WaitTime) == false);
    time_point t1 = Clock::now();
    ns d = t1 - t0 - WaitTime;
    assert(d < Tolerance);  // within tolerance
}
コード例 #2
0
void f1()
{
    time_point t0 = Clock::now();
    assert(m.try_lock_until(Clock::now() + WaitTime + Tolerance) == true);
    time_point t1 = Clock::now();
    m.unlock();
    ns d = t1 - t0 - WaitTime;
    assert(d < Tolerance);  // within tolerance
}