Public Member Functions | Static Protected Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
absl::base_internal::SpinLock Class Reference

#include <spinlock.h>

Public Member Functions

bool IsHeld () const
 
void Lock () EXCLUSIVE_LOCK_FUNCTION()
 
 SpinLock ()
 
 SpinLock (base_internal::LinkerInitialized)
 
 SpinLock (base_internal::SchedulingMode mode)
 
 SpinLock (base_internal::LinkerInitialized, base_internal::SchedulingMode mode)
 
bool TryLock () EXCLUSIVE_TRYLOCK_FUNCTION(true)
 
void Unlock () UNLOCK_FUNCTION()
 
 ~SpinLock ()
 

Static Protected Member Functions

static uint64_t DecodeWaitCycles (uint32_t lock_value)
 
static uint32_t EncodeWaitCycles (int64_t wait_start_time, int64_t wait_end_time)
 

Private Types

enum  { kSpinLockCooperative = 2 }
 
enum  { kSpinLockDisabledScheduling = 4 }
 
enum  { kSpinLockSleeper = 8 }
 
enum  { kWaitTimeMask }
 
enum  { kSpinLockHeld = 1 }
 

Private Member Functions

void InitLinkerInitializedAndCooperative ()
 
SpinLockoperator= (const SpinLock &)=delete
 
void SlowLock () ABSL_ATTRIBUTE_COLD
 
void SlowUnlock (uint32_t lock_value) ABSL_ATTRIBUTE_COLD
 
 SpinLock (const SpinLock &)=delete
 
uint32_t SpinLoop ()
 
bool TryLockImpl ()
 
uint32_t TryLockInternal (uint32_t lock_value, uint32_t wait_cycles)
 

Static Private Member Functions

static constexpr bool IsCooperative (base_internal::SchedulingMode scheduling_mode)
 

Private Attributes

std::atomic< uint32_t > lockword_
 

Friends

struct SpinLockTest
 

Detailed Description

Definition at line 51 of file spinlock.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
kSpinLockCooperative 

Definition at line 151 of file spinlock.h.

◆ anonymous enum

anonymous enum
private
Enumerator
kSpinLockDisabledScheduling 

Definition at line 152 of file spinlock.h.

◆ anonymous enum

anonymous enum
private
Enumerator
kSpinLockSleeper 

Definition at line 153 of file spinlock.h.

◆ anonymous enum

anonymous enum
private
Enumerator
kWaitTimeMask 

Definition at line 154 of file spinlock.h.

◆ anonymous enum

anonymous enum
private
Enumerator
kSpinLockHeld 

Definition at line 150 of file spinlock.h.

Constructor & Destructor Documentation

◆ SpinLock() [1/5]

absl::base_internal::SpinLock::SpinLock ( )
inline

Definition at line 53 of file spinlock.h.

◆ SpinLock() [2/5]

absl::base_internal::SpinLock::SpinLock ( base_internal::LinkerInitialized  )
inlineexplicit

Definition at line 68 of file spinlock.h.

◆ SpinLock() [3/5]

absl::base_internal::SpinLock::SpinLock ( base_internal::SchedulingMode  mode)
explicit

Definition at line 69 of file spinlock.cc.

◆ SpinLock() [4/5]

absl::base_internal::SpinLock::SpinLock ( base_internal::LinkerInitialized  ,
base_internal::SchedulingMode  mode 
)

Definition at line 74 of file spinlock.cc.

◆ ~SpinLock()

absl::base_internal::SpinLock::~SpinLock ( )
inline

Definition at line 79 of file spinlock.h.

◆ SpinLock() [5/5]

absl::base_internal::SpinLock::SpinLock ( const SpinLock )
privatedelete

Member Function Documentation

◆ DecodeWaitCycles()

uint64_t absl::base_internal::SpinLock::DecodeWaitCycles ( uint32_t  lock_value)
staticprotected

Definition at line 222 of file spinlock.cc.

◆ EncodeWaitCycles()

uint32_t absl::base_internal::SpinLock::EncodeWaitCycles ( int64_t  wait_start_time,
int64_t  wait_end_time 
)
staticprotected

Definition at line 198 of file spinlock.cc.

◆ InitLinkerInitializedAndCooperative()

void absl::base_internal::SpinLock::InitLinkerInitializedAndCooperative ( )
private

Definition at line 91 of file spinlock.cc.

◆ IsCooperative()

static constexpr bool absl::base_internal::SpinLock::IsCooperative ( base_internal::SchedulingMode  scheduling_mode)
inlinestaticprivate

Definition at line 158 of file spinlock.h.

◆ IsHeld()

bool absl::base_internal::SpinLock::IsHeld ( ) const
inline

Definition at line 125 of file spinlock.h.

◆ Lock()

void absl::base_internal::SpinLock::Lock ( )
inline

Definition at line 82 of file spinlock.h.

◆ operator=()

SpinLock& absl::base_internal::SpinLock::operator= ( const SpinLock )
privatedelete

◆ SlowLock()

void absl::base_internal::SpinLock::SlowLock ( )
private

Definition at line 117 of file spinlock.cc.

◆ SlowUnlock()

void absl::base_internal::SpinLock::SlowUnlock ( uint32_t  lock_value)
private

Definition at line 174 of file spinlock.cc.

◆ SpinLoop()

uint32_t absl::base_internal::SpinLock::SpinLoop ( )
private

Definition at line 100 of file spinlock.cc.

◆ TryLock()

bool absl::base_internal::SpinLock::TryLock ( )
inline

Definition at line 94 of file spinlock.h.

◆ TryLockImpl()

bool absl::base_internal::SpinLock::TryLockImpl ( )
inlineprivate

Definition at line 169 of file spinlock.h.

◆ TryLockInternal()

uint32_t absl::base_internal::SpinLock::TryLockInternal ( uint32_t  lock_value,
uint32_t  wait_cycles 
)
inlineprivate

Definition at line 213 of file spinlock.h.

◆ Unlock()

void absl::base_internal::SpinLock::Unlock ( )
inline

Definition at line 104 of file spinlock.h.

Friends And Related Function Documentation

◆ SpinLockTest

friend struct SpinLockTest
friend

Definition at line 141 of file spinlock.h.

Member Data Documentation

◆ lockword_

std::atomic<uint32_t> absl::base_internal::SpinLock::lockword_
private

Definition at line 174 of file spinlock.h.


The documentation for this class was generated from the following files:


abseil_cpp
Author(s):
autogenerated on Mon Feb 28 2022 21:31:22