oasys::SXLock Class Reference

#include <SXLock.h>

List of all members.


Detailed Description

Lock with shared and exclusive semantics.

XXX/bowei -- convert this to use atomic instructions directly

Definition at line 33 of file SXLock.h.


Public Member Functions

 SXLock (Lock *lock)
void shared_lock ()
void shared_unlock ()
 Drop the shared lock.
void exclusive_lock ()
void exclusive_unlock ()
 Drop the write lock.

Private Attributes

Locklock_
int scount_
int xcount_

Constructor & Destructor Documentation

oasys::SXLock::SXLock ( Lock lock  )  [inline]

Definition at line 35 of file SXLock.h.


Member Function Documentation

void oasys::SXLock::shared_lock (  )  [inline]

Acquire a shared lock. Any number of readers are permitted inside a shared lock.

Definition at line 45 of file SXLock.h.

References oasys::Lock::lock(), lock_, scount_, oasys::Thread::spin_yield(), oasys::Lock::unlock(), and xcount_.

void oasys::SXLock::shared_unlock (  )  [inline]

Drop the shared lock.

Definition at line 57 of file SXLock.h.

References oasys::Lock::lock(), lock_, scount_, and oasys::Lock::unlock().

void oasys::SXLock::exclusive_lock (  )  [inline]

Acquire the write lock. Only one writer is permitted to hold the write lock. No readers are allowed inside when the write lock is held.

Definition at line 68 of file SXLock.h.

References oasys::Lock::lock(), lock_, scount_, oasys::Thread::spin_yield(), oasys::Lock::unlock(), and xcount_.

void oasys::SXLock::exclusive_unlock (  )  [inline]

Drop the write lock.

Definition at line 87 of file SXLock.h.

References oasys::Lock::lock(), lock_, oasys::Lock::unlock(), and xcount_.


Member Data Documentation

Lock* oasys::SXLock::lock_ [private]

Definition at line 101 of file SXLock.h.

Referenced by exclusive_lock(), exclusive_unlock(), shared_lock(), and shared_unlock().

int oasys::SXLock::scount_ [private]

Definition at line 103 of file SXLock.h.

Referenced by exclusive_lock(), shared_lock(), and shared_unlock().

int oasys::SXLock::xcount_ [private]

Definition at line 104 of file SXLock.h.

Referenced by exclusive_lock(), exclusive_unlock(), and shared_lock().


The documentation for this class was generated from the following file:
Generated on Sat Sep 8 08:36:26 2007 for DTN Reference Implementation by  doxygen 1.5.3