CUBRID Engine  latest
HL::SpinLockType Class Reference

#include <spinlock-old.h>

Collaboration diagram for HL::SpinLockType:
Collaboration graph

Public Member Functions

 SpinLockType (void)
 
 ~SpinLockType ()
 
void lock ()
 
void unlock ()
 

Static Public Member Functions

static size_t MyInterlockedExchange (size_t *, size_t)
 

Private Types

enum  { UNLOCKED = 0, LOCKED = 1 }
 
enum  { MAX_SPIN_LIMIT = 1024 }
 

Private Member Functions

NO_INLINE void contendedLock ()
 
bool onMultiprocessor (void)
 
void yieldProcessor (void)
 

Private Attributes

volatile size_t mutex
 

Detailed Description

Definition at line 88 of file spinlock-old.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
UNLOCKED 
LOCKED 

Definition at line 91 of file spinlock-old.h.

anonymous enum
private
Enumerator
MAX_SPIN_LIMIT 

Definition at line 177 of file spinlock-old.h.

Constructor & Destructor Documentation

HL::SpinLockType::SpinLockType ( void  )
inline

Definition at line 95 of file spinlock-old.h.

HL::SpinLockType::~SpinLockType ( )
inline

Definition at line 103 of file spinlock-old.h.

Member Function Documentation

NO_INLINE void HL::SpinLockType::contendedLock ( )
inlineprivate

Definition at line 143 of file spinlock-old.h.

References _MM_PAUSE, cubregex::count(), LOCKED, UNLOCKED, and yieldProcessor().

Referenced by lock().

Here is the caller graph for this function:

void HL::SpinLockType::lock ( )
inline

Definition at line 106 of file spinlock-old.h.

References contendedLock(), LOCKED, mutex, MyInterlockedExchange(), and UNLOCKED.

size_t HL::SpinLockType::MyInterlockedExchange ( size_t *  oldval,
size_t  newval 
)
inlinestatic

Definition at line 193 of file spinlock-old.h.

Referenced by lock(), and unlock().

Here is the caller graph for this function:

bool HL::SpinLockType::onMultiprocessor ( void  )
inlineprivate

Definition at line 162 of file spinlock-old.h.

References HL::CPUInfo::getNumProcessors().

void HL::SpinLockType::unlock ( )
inline

Definition at line 119 of file spinlock-old.h.

References mutex, MyInterlockedExchange(), NO_INLINE, and UNLOCKED.

void HL::SpinLockType::yieldProcessor ( void  )
inlineprivate

Definition at line 167 of file spinlock-old.h.

Referenced by contendedLock().

Here is the caller graph for this function:

Member Data Documentation

volatile size_t HL::SpinLockType::mutex
private

Definition at line 179 of file spinlock-old.h.

Referenced by lock(), and unlock().


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