Use FUTEX_WAIT_BITSET to avoid converting timeouts.
Add unittests for pthread APIs with timeout parameter.
Bug: 17569991
Change-Id: I6b3b9b2feae03680654cd64c3112ce7644632c87
diff --git a/libc/bionic/pthread_barrier.cpp b/libc/bionic/pthread_barrier.cpp
index 3227daf..1bcd12a 100644
--- a/libc/bionic/pthread_barrier.cpp
+++ b/libc/bionic/pthread_barrier.cpp
@@ -118,7 +118,7 @@
// threads have left the barrier. Use acquire operation here to synchronize with
// the last thread leaving the previous cycle, so we can read correct wait_count below.
while(atomic_load_explicit(&barrier->state, memory_order_acquire) == RELEASE) {
- __futex_wait_ex(&barrier->state, barrier->pshared, RELEASE, nullptr);
+ __futex_wait_ex(&barrier->state, barrier->pshared, RELEASE, false, nullptr);
}
uint32_t prev_wait_count = atomic_load_explicit(&barrier->wait_count, memory_order_relaxed);
@@ -152,7 +152,7 @@
// Use acquire operation here to synchronize between the last thread entering the
// barrier with all threads leaving the barrier.
while (atomic_load_explicit(&barrier->state, memory_order_acquire) == WAIT) {
- __futex_wait_ex(&barrier->state, barrier->pshared, WAIT, nullptr);
+ __futex_wait_ex(&barrier->state, barrier->pshared, WAIT, false, nullptr);
}
}
// Use release operation here to make it not reordered with previous operations.
@@ -173,7 +173,7 @@
// Use acquire operation here to synchronize with the last thread leaving the barrier.
// So we can read correct wait_count below.
while (atomic_load_explicit(&barrier->state, memory_order_acquire) == RELEASE) {
- __futex_wait_ex(&barrier->state, barrier->pshared, RELEASE, nullptr);
+ __futex_wait_ex(&barrier->state, barrier->pshared, RELEASE, false, nullptr);
}
if (atomic_load_explicit(&barrier->wait_count, memory_order_relaxed) != 0) {
return EBUSY;