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 17 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 19 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 29 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 41 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 52 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 71 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 85 of file SXLock.h.

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

int oasys::SXLock::scount_ [private]

Definition at line 87 of file SXLock.h.

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

int oasys::SXLock::xcount_ [private]

Definition at line 88 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 Fri Dec 22 14:48:07 2006 for DTN Reference Implementation by  doxygen 1.5.1