void f2() { time_point t0 = Clock::now(); assert(m.try_lock_shared_for(WaitTime) == false); time_point t1 = Clock::now(); ns d = t1 - t0 - WaitTime; assert(d < Tolerance); // within 50ms }
void f2() { time_point t0 = Clock::now(); assert(m.try_lock_shared_for(ms(250)) == false); time_point t1 = Clock::now(); ns d = t1 - t0 - ms(250); assert(d < ms(50)); // within 50ms }
void f1() { time_point t0 = Clock::now(); assert(m.try_lock_shared_for(WaitTime + Tolerance) == true); time_point t1 = Clock::now(); m.unlock_shared(); ns d = t1 - t0 - WaitTime; assert(d < Tolerance); // within 50ms }
void f1() { time_point t0 = Clock::now(); assert(m.try_lock_shared_for(ms(300)) == true); time_point t1 = Clock::now(); m.unlock_shared(); ns d = t1 - t0 - ms(250); assert(d < ms(50)); // within 50ms }