about summary refs log tree commit diff
path: root/absl/synchronization/internal/waiter.cc
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2019-12-06T13·36-0800
committerMark Barolak <mbar@google.com>2019-12-06T15·28-0500
commit77f87009a34c745255bd84d8f2647040d831a2b3 (patch)
treec3ad7ba85325074fa1ae50590c90e6b4b331fa4f /absl/synchronization/internal/waiter.cc
parentd659fe54b35ab9b8e35c72e50a4b8814167d5a84 (diff)
Export of internal Abseil changes
--
d8ddeda8e52132b908fae89b25f117a055d78c04 by Abseil Team <absl-team@google.com>:

Improve performance of ByteStringFromAscii by changing kHexValue to have -1 in invalid value slots. This way a single load can do both the validation and conversion.

PiperOrigin-RevId: 284167344

--
5037e97e2eaaac8ced9a5290949deda4b43b9ceb by Mark Barolak <mbar@google.com>:

Change the underlying symbol name of Cord to absl::Cord.

PiperOrigin-RevId: 284005429

--
4ef66c72aedf135f2b4fd0ba7a73de6642decfff by Abseil Team <absl-team@google.com>:

Eliminate an unnecessary load when futex is contended in Waiter::Wait()

The first argument to compare_exchange_weak() is a reference and will be
updated upon failure.  There is no need to do an additional load on the
same variable.

PiperOrigin-RevId: 284002752
GitOrigin-RevId: d8ddeda8e52132b908fae89b25f117a055d78c04
Change-Id: Idac68a1901eb8c30050adc3860765b1a6fa085c7
Diffstat (limited to '')
-rw-r--r--absl/synchronization/internal/waiter.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/absl/synchronization/internal/waiter.cc b/absl/synchronization/internal/waiter.cc
index f1425872e5b6..e7000d3a56e1 100644
--- a/absl/synchronization/internal/waiter.cc
+++ b/absl/synchronization/internal/waiter.cc
@@ -136,7 +136,7 @@ bool Waiter::Wait(KernelTimeout t) {
   bool first_pass = true;
   while (true) {
     int32_t x = futex_.load(std::memory_order_relaxed);
-    if (x != 0) {
+    while (x != 0) {
       if (!futex_.compare_exchange_weak(x, x - 1,
                                         std::memory_order_acquire,
                                         std::memory_order_relaxed)) {
@@ -313,7 +313,7 @@ bool Waiter::Wait(KernelTimeout t) {
   bool first_pass = true;
   while (true) {
     int x = wakeups_.load(std::memory_order_relaxed);
-    if (x != 0) {
+    while (x != 0) {
       if (!wakeups_.compare_exchange_weak(x, x - 1,
                                           std::memory_order_acquire,
                                           std::memory_order_relaxed)) {