9#ifndef THREAD_BOOST_PRIMITIVES_H_
10#define THREAD_BOOST_PRIMITIVES_H_
14#include <absl/base/nullability.h>
16#include "absl/base/thread_annotations.h"
17#include "absl/time/time.h"
27class ABSL_LOCKABLE Mutex {
34 void Lock() noexcept ABSL_EXCLUSIVE_LOCK_FUNCTION();
35 void Unlock() noexcept ABSL_UNLOCK_FUNCTION();
37 void lock() noexcept ABSL_EXCLUSIVE_LOCK_FUNCTION() { Lock(); }
39 void unlock() noexcept ABSL_UNLOCK_FUNCTION() { Unlock(); }
44 static constexpr std::size_t kImplSize = 64;
45 alignas(std::max_align_t) std::byte impl_[kImplSize];
46 Impl* absl_nonnull GetImpl();
49class ABSL_SCOPED_LOCKABLE MutexLock {
62 Mutex* absl_nonnull mu_;
83 static constexpr
std::
size_t kImplSize = 64;
84 alignas(
std::max_align_t)
std::
byte impl_[kImplSize];
85 Impl* absl_nonnull GetImpl();
88void SleepFor(absl::Duration duration);
Definition boost_primitives.h:113
bool WaitWithTimeout(Mutex *absl_nonnull mu, absl::Duration timeout) noexcept
void Wait(Mutex *absl_nonnull mu) noexcept
bool WaitWithDeadline(Mutex *absl_nonnull mu, absl::Time deadline) noexcept
CondVar(const CondVar &)=delete
void SignalAll() noexcept
Definition boost_primitives.h:234
~CondVar()
Definition boost_primitives.cc:62
CondVar & operator=(const CondVar &)=delete
Definition boost_primitives.h:97
~MutexLock() ABSL_UNLOCK_FUNCTION()
Definition boost_primitives.h:59
MutexLock(Mutex *absl_nonnull mu) ABSL_EXCLUSIVE_LOCK_FUNCTION(mu)
Definition boost_primitives.h:51
MutexLock(const MutexLock &)=delete
MutexLock & operator=(const MutexLock &)=delete
Definition boost_primitives.h:36
void Lock() noexcept ABSL_EXCLUSIVE_LOCK_FUNCTION()
Mutex & operator=(const Mutex &)=delete
void unlock() noexcept ABSL_UNLOCK_FUNCTION()
Definition boost_primitives.h:39
Mutex(const Mutex &)=delete
Definition native_camera_stream.cc:19
void SleepFor(absl::Duration duration)
Definition boost_primitives.h:267
constexpr bool kCanParkAwait
Definition boost_primitives.h:30
bool CanParkAwait() noexcept
Definition boost_primitives.h:32
Definition boost_primitives.cc:51