This reverts commit fd2457b10fc2713bfd5d86952216cf89b6283a90. Reason for revert: <INSERT REASONING HERE> Original change's description: > Roll chromium_revision e1ef7d4b6b..b47e7752c6 (568794:569173) > > Change log:e1ef7d4b6b..b47e7752c6> Full diff:e1ef7d4b6b..b47e7752c6> > Roll chromium third_party ab9fbe29c9..630af48a96 > Change log:ab9fbe29c9..630af48a96> > Changed dependencies: > * src/base:03e1bc561f..6070b24b9f> * src/build:bb306be407..511e258eee> * src/ios:48697bf3a1..ce1db7deb1> * src/testing:6440c4ea3a..80a4cfaab7> * src/third_party/catapult: https://chromium.googlesource.com/catapult.git/+log/f153b902be..f3c454475a > * src/third_party/depot_tools:1cabdc4643..a28b14f122> * src/tools:66f1089d0c..f6bb2a6fb4> DEPS diff:e1ef7d4b6b..b47e7752c6/DEPS > > No update to Clang. > > TBR=buildbot@webrtc.org, > BUG=None > CQ_INCLUDE_TRYBOTS=master.internal.tryserver.corp.webrtc:linux_internal > NO_AUTOIMPORT_DEPS_CHECK=true > > Change-Id: I7553549111225f2c5bc769dec114cd058ae699d5 > Reviewed-on: https://webrtc-review.googlesource.com/84600 > Reviewed-by: WebRTC Buildbot <buildbot@webrtc.org> > Commit-Queue: WebRTC Buildbot <buildbot@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#23692} TBR=buildbot@webrtc.org Change-Id: I7d136553622fe4c4e49dbd9c60406811a8b11bd8 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: None Cq-Include-Trybots: master.internal.tryserver.corp.webrtc:linux_internal Reviewed-on: https://webrtc-review.googlesource.com/84720 Reviewed-by: Artem Titov <titovartem@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23708}
92 lines
3.6 KiB
C++
92 lines
3.6 KiB
C++
// 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
|
|
//
|
|
// http://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.
|
|
|
|
#ifndef ABSL_BASE_INTERNAL_SPINLOCK_WAIT_H_
|
|
#define ABSL_BASE_INTERNAL_SPINLOCK_WAIT_H_
|
|
|
|
// Operations to make atomic transitions on a word, and to allow
|
|
// waiting for those transitions to become possible.
|
|
|
|
#include <stdint.h>
|
|
#include <atomic>
|
|
|
|
#include "absl/base/internal/scheduling_mode.h"
|
|
|
|
namespace absl {
|
|
namespace base_internal {
|
|
|
|
// SpinLockWait() waits until it can perform one of several transitions from
|
|
// "from" to "to". It returns when it performs a transition where done==true.
|
|
struct SpinLockWaitTransition {
|
|
uint32_t from;
|
|
uint32_t to;
|
|
bool done;
|
|
};
|
|
|
|
// Wait until *w can transition from trans[i].from to trans[i].to for some i
|
|
// satisfying 0<=i<n && trans[i].done, atomically make the transition,
|
|
// then return the old value of *w. Make any other atomic transitions
|
|
// where !trans[i].done, but continue waiting.
|
|
uint32_t SpinLockWait(std::atomic<uint32_t> *w, int n,
|
|
const SpinLockWaitTransition trans[],
|
|
SchedulingMode scheduling_mode);
|
|
|
|
// If possible, wake some thread that has called SpinLockDelay(w, ...). If
|
|
// "all" is true, wake all such threads. This call is a hint, and on some
|
|
// systems it may be a no-op; threads calling SpinLockDelay() will always wake
|
|
// eventually even if SpinLockWake() is never called.
|
|
void SpinLockWake(std::atomic<uint32_t> *w, bool all);
|
|
|
|
// Wait for an appropriate spin delay on iteration "loop" of a
|
|
// spin loop on location *w, whose previously observed value was "value".
|
|
// SpinLockDelay() may do nothing, may yield the CPU, may sleep a clock tick,
|
|
// or may wait for a delay that can be truncated by a call to SpinLockWake(w).
|
|
// In all cases, it must return in bounded time even if SpinLockWake() is not
|
|
// called.
|
|
void SpinLockDelay(std::atomic<uint32_t> *w, uint32_t value, int loop,
|
|
base_internal::SchedulingMode scheduling_mode);
|
|
|
|
// Helper used by AbslInternalSpinLockDelay.
|
|
// Returns a suggested delay in nanoseconds for iteration number "loop".
|
|
int SpinLockSuggestedDelayNS(int loop);
|
|
|
|
} // namespace base_internal
|
|
} // namespace absl
|
|
|
|
// In some build configurations we pass --detect-odr-violations to the
|
|
// gold linker. This causes it to flag weak symbol overrides as ODR
|
|
// violations. Because ODR only applies to C++ and not C,
|
|
// --detect-odr-violations ignores symbols not mangled with C++ names.
|
|
// By changing our extension points to be extern "C", we dodge this
|
|
// check.
|
|
extern "C" {
|
|
void AbslInternalSpinLockWake(std::atomic<uint32_t> *w, bool all);
|
|
void AbslInternalSpinLockDelay(
|
|
std::atomic<uint32_t> *w, uint32_t value, int loop,
|
|
absl::base_internal::SchedulingMode scheduling_mode);
|
|
}
|
|
|
|
inline void absl::base_internal::SpinLockWake(std::atomic<uint32_t> *w,
|
|
bool all) {
|
|
AbslInternalSpinLockWake(w, all);
|
|
}
|
|
|
|
inline void absl::base_internal::SpinLockDelay(
|
|
std::atomic<uint32_t> *w, uint32_t value, int loop,
|
|
base_internal::SchedulingMode scheduling_mode) {
|
|
AbslInternalSpinLockDelay(w, value, loop, scheduling_mode);
|
|
}
|
|
|
|
#endif // ABSL_BASE_INTERNAL_SPINLOCK_WAIT_H_
|