Merge "Fix a race condition in the bionic pthread tests."
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp
index e4f9cb8..907a35c 100644
--- a/tests/pthread_test.cpp
+++ b/tests/pthread_test.cpp
@@ -1493,6 +1493,7 @@
};
std::atomic<Progress> progress;
pthread_t thread;
+ timespec ts;
std::function<int (pthread_cond_t* cond, pthread_mutex_t* mutex)> wait_function;
protected:
@@ -1524,11 +1525,10 @@
clockid_t clock,
std::function<int(pthread_cond_t* cond, pthread_mutex_t* mutex, const timespec* timeout)>
wait_function) {
- timespec ts;
ASSERT_EQ(0, clock_gettime(clock, &ts));
ts.tv_sec += 1;
- StartWaitingThread([&wait_function, &ts](pthread_cond_t* cond, pthread_mutex_t* mutex) {
+ StartWaitingThread([&wait_function, this](pthread_cond_t* cond, pthread_mutex_t* mutex) {
return wait_function(cond, mutex, &ts);
});