Go to the documentation of this file.
58 #ifndef ABSL_SYNCHRONIZATION_MUTEX_H_
59 #define ABSL_SYNCHRONIZATION_MUTEX_H_
65 #include "absl/base/const_init.h"
66 #include "absl/base/internal/identity.h"
67 #include "absl/base/internal/low_level_alloc.h"
68 #include "absl/base/internal/thread_identity.h"
69 #include "absl/base/internal/tsan_mutex_interface.h"
70 #include "absl/base/port.h"
71 #include "absl/base/thread_annotations.h"
72 #include "absl/synchronization/internal/kernel_timeout.h"
73 #include "absl/synchronization/internal/per_thread_sem.h"
74 #include "absl/time/time.h"
80 struct SynchWaitParams;
258 return this->TryLock();
316 this->LockWhen(
cond);
381 return this->LockWhenWithDeadline(
cond, deadline);
401 void EnableInvariantDebugging(
void (*
invariant)(
void *),
void *
arg);
410 void EnableDebugLog(
const char *
name);
419 void ForgetDeadlockInfo();
432 void AssertNotHeld()
const;
453 static void InternalAttemptToUseMutexInFatalSignalHandler();
456 std::atomic<intptr_t>
mu_;
485 void Trans(
MuHow how);
717 template <
typename T,
typename E = decltype(
718 static_cast<bool (
T::*)()
const>(&T::operator()))>
860 std::atomic<intptr_t>
cv_;
878 if (this->
mu_ !=
nullptr) {
886 if (this->
mu_ !=
nullptr) {
892 if (this->
mu_ !=
nullptr) { this->
mu_->Unlock(); }
921 if (this->
mu_ !=
nullptr) { this->
mu_->Unlock(); }
943 template <
typename T>
945 typedef bool (
T::*MemberType)();
946 MemberType
rm =
reinterpret_cast<MemberType
>(
c->method_);
947 T *
x =
static_cast<T *
>(
c->arg_);
952 template <
typename T>
954 typedef bool (*FuncType)(
T *);
955 FuncType
fn =
reinterpret_cast<FuncType
>(
c->function_);
956 T *
x =
static_cast<T *
>(
c->arg_);
960 template <
typename T>
962 : eval_(&CastAndCallFunction<
T>),
963 function_(reinterpret_cast<InternalFunctionType>(
func)),
965 arg_(const_cast<void *>(static_cast<
const void *>(
arg))) {}
967 template <
typename T>
970 : eval_(&CastAndCallMethod<
T>),
972 method_(reinterpret_cast<InternalMethodType>(
method)),
975 template <
typename T>
979 : eval_(&CastAndCallMethod<
T>),
981 method_(reinterpret_cast<InternalMethodType>(
method)),
982 arg_(reinterpret_cast<void *>(const_cast<
T *>(object))) {}
1038 ABSL_DEPRECATED(
"absl::RegisterSymbolizer() is deprecated and will be removed "
1039 "on or after 2023-05-01")
1082 #endif // ABSL_SYNCHRONIZATION_MUTEX_H_
ReaderMutexLock(Mutex *mu) ABSL_SHARED_LOCK_FUNCTION(mu)
OPENSSL_EXPORT const ASN1_OBJECT * obj
#define ABSL_ASSERT_SHARED_LOCK(...)
#define WriterMutexLock(x)
bool(* InternalFunctionType)(void *arg)
void RegisterSymbolizer(bool(*fn)(const void *pc, char *out, int out_size))
WriterMutexLock(Mutex *mu, const Condition &cond) ABSL_EXCLUSIVE_LOCK_FUNCTION(mu)
MutexLockMaybe(Mutex *mu, const Condition &cond) ABSL_EXCLUSIVE_LOCK_FUNCTION(mu)
static bool CallVoidPtrFunction(const Condition *)
MutexLock(Mutex *mu, const Condition &cond) ABSL_EXCLUSIVE_LOCK_FUNCTION(mu)
void(* invariant)(void *arg)
std::condition_variable cv_
~WriterMutexLock() ABSL_UNLOCK_FUNCTION()
MutexLock(Mutex *mu) ABSL_EXCLUSIVE_LOCK_FUNCTION(mu)
void WriterUnlock() ABSL_UNLOCK_FUNCTION()
void WriterLockWhen(const Condition &cond) ABSL_EXCLUSIVE_LOCK_FUNCTION()
bool(* eval_)(const Condition *)
~ReleasableMutexLock() ABSL_UNLOCK_FUNCTION()
#define ABSL_NAMESPACE_END
CondVar & operator=(const CondVar &)=delete
#define T(upbtypeconst, upbtype, ctype, default_value)
void Remove(base_internal::PerThreadSynch *s)
void EnableDebugLog(const char *name)
MutexLockMaybe(Mutex *mu) ABSL_EXCLUSIVE_LOCK_FUNCTION(mu)
std::condition_variable Condition
ReleasableMutexLock(Mutex *mu) ABSL_EXCLUSIVE_LOCK_FUNCTION(mu)
#define ABSL_NAMESPACE_BEGIN
bool WaitCommon(Mutex *mutex, synchronization_internal::KernelTimeout t)
void ABSL_INTERNAL_C_SYMBOL() AbslInternalMutexYield()
~MutexLockMaybe() ABSL_UNLOCK_FUNCTION()
#define ABSL_SHARED_TRYLOCK_FUNCTION(...)
#define ABSL_TSAN_MUTEX_CREATE(...)
static bool GuaranteedEqual(const Condition *a, const Condition *b)
#define ABSL_EXCLUSIVE_TRYLOCK_FUNCTION(...)
bool(* InternalMethodCallerType)(void *arg, InternalMethodType internal_method)
ReaderMutexLock(Mutex *mu, const Condition &cond) ABSL_SHARED_LOCK_FUNCTION(mu)
~MutexLock() ABSL_UNLOCK_FUNCTION()
void RegisterMutexTracer(void(*fn)(const char *msg, const void *obj, int64_t wait_cycles))
const struct MuHowS * MuHow
static bool CastAndCallMethod(const Condition *c)
static bool rm(upb_table *t, lookupkey_t key, upb_value *val, upb_tabkey *removed, uint32_t hash, eqlfunc_t *eql)
bool WriterTryLock() ABSL_EXCLUSIVE_TRYLOCK_FUNCTION(true)
#define ABSL_INTERNAL_C_SYMBOL(x)
void RegisterMutexProfiler(void(*fn)(int64_t wait_cycles))
WriterMutexLock(Mutex *mu) ABSL_EXCLUSIVE_LOCK_FUNCTION(mu)
#define ABSL_EXCLUSIVE_LOCK_FUNCTION(...)
static const Condition kTrue
void RegisterCondVarTracer(void(*fn)(const char *msg, const void *cv))
#define ReaderMutexLock(x)
bool WriterLockWhenWithDeadline(const Condition &cond, absl::Time deadline) ABSL_EXCLUSIVE_LOCK_FUNCTION()
~ReaderMutexLock() ABSL_UNLOCK_FUNCTION()
std::atomic< intptr_t > cv_
ReleasableMutexLock(Mutex *mu, const Condition &cond) ABSL_EXCLUSIVE_LOCK_FUNCTION(mu)
#define ABSL_SHARED_LOCK_FUNCTION(...)
bool WaitWithDeadline(Mutex *mu, absl::Time deadline)
#define ABSL_ATTRIBUTE_COLD
#define ABSL_ASSERT_EXCLUSIVE_LOCK(...)
void EnableMutexInvariantDebugging(bool enabled)
bool WriterLockWhenWithTimeout(const Condition &cond, absl::Duration timeout) ABSL_EXCLUSIVE_LOCK_FUNCTION()
Mutex(const volatile Mutex *)
ABSL_DEPRECATED("absl::RegisterSymbolizer() is deprecated and will be removed " "on or after 2023-05-01") void RegisterSymbolizer(bool(*fn)(const void *pc
static bool CastAndCallFunction(const Condition *c)
#define ABSL_UNLOCK_FUNCTION(...)
InternalFunctionType function_
void SetMutexDeadlockDetectionMode(OnDeadlockCycle mode)
bool WaitWithTimeout(Mutex *mu, absl::Duration timeout)
InternalMethodType method_
#define ABSL_SCOPED_LOCKABLE
bool(Condition::* InternalMethodType)()
void Wakeup(base_internal::PerThreadSynch *w)
grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:31