From 5aa5d282eac56a21e74611c1cdbaa97bb5db2dca Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 8 Feb 2022 02:05:36 +0300 Subject: chore(3p/abseil_cpp): unvendor abseil_cpp we weren't actually using these sources anymore, okay? Change-Id: If701571d9716de308d3512e1eb22c35db0877a66 Reviewed-on: https://cl.tvl.fyi/c/depot/+/5248 Tested-by: BuildkiteCI Reviewed-by: grfn Autosubmit: tazjin --- .../abseil_cpp/absl/base/internal/spinlock_wait.cc | 81 ---------------------- 1 file changed, 81 deletions(-) delete mode 100644 third_party/abseil_cpp/absl/base/internal/spinlock_wait.cc (limited to 'third_party/abseil_cpp/absl/base/internal/spinlock_wait.cc') diff --git a/third_party/abseil_cpp/absl/base/internal/spinlock_wait.cc b/third_party/abseil_cpp/absl/base/internal/spinlock_wait.cc deleted file mode 100644 index fa824be1c008..000000000000 --- a/third_party/abseil_cpp/absl/base/internal/spinlock_wait.cc +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2017 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// The OS-specific header included below must provide two calls: -// AbslInternalSpinLockDelay() and AbslInternalSpinLockWake(). -// See spinlock_wait.h for the specs. - -#include -#include - -#include "absl/base/internal/spinlock_wait.h" - -#if defined(_WIN32) -#include "absl/base/internal/spinlock_win32.inc" -#elif defined(__linux__) -#include "absl/base/internal/spinlock_linux.inc" -#elif defined(__akaros__) -#include "absl/base/internal/spinlock_akaros.inc" -#else -#include "absl/base/internal/spinlock_posix.inc" -#endif - -namespace absl { -ABSL_NAMESPACE_BEGIN -namespace base_internal { - -// See spinlock_wait.h for spec. -uint32_t SpinLockWait(std::atomic *w, int n, - const SpinLockWaitTransition trans[], - base_internal::SchedulingMode scheduling_mode) { - int loop = 0; - for (;;) { - uint32_t v = w->load(std::memory_order_acquire); - int i; - for (i = 0; i != n && v != trans[i].from; i++) { - } - if (i == n) { - SpinLockDelay(w, v, ++loop, scheduling_mode); // no matching transition - } else if (trans[i].to == v || // null transition - w->compare_exchange_strong(v, trans[i].to, - std::memory_order_acquire, - std::memory_order_relaxed)) { - if (trans[i].done) return v; - } - } -} - -static std::atomic delay_rand; - -// Return a suggested delay in nanoseconds for iteration number "loop" -int SpinLockSuggestedDelayNS(int loop) { - // Weak pseudo-random number generator to get some spread between threads - // when many are spinning. - uint64_t r = delay_rand.load(std::memory_order_relaxed); - r = 0x5deece66dLL * r + 0xb; // numbers from nrand48() - delay_rand.store(r, std::memory_order_relaxed); - - if (loop < 0 || loop > 32) { // limit loop to 0..32 - loop = 32; - } - const int kMinDelay = 128 << 10; // 128us - // Double delay every 8 iterations, up to 16x (2ms). - int delay = kMinDelay << (loop / 8); - // Randomize in delay..2*delay range, for resulting 128us..4ms range. - return delay | ((delay - 1) & static_cast(r)); -} - -} // namespace base_internal -ABSL_NAMESPACE_END -} // namespace absl -- cgit 1.4.1