The thread created to test Throttle race conditions updates a value (
throttle.get_current() ) that is tested by the main gtest thread but is
not protected by a lock. Instead of adding a lock, the main thread tests
the value after pthread_join() on the child thread.
http://tracker.ceph.com/issues/6679 fixes #6679
Signed-off-by: Loic Dachary <loic@dachary.org>
//
throttle.wait(throttle_max * 100);
usleep(delay);
- ASSERT_EQ(throttle.get_current(), throttle_max / 2);
-
-
t.join();
+ ASSERT_EQ(throttle.get_current(), throttle_max / 2);
if (!(waited = t.waited)) {
delay *= 2;