Kyoto Cabinet
Public Member Functions
kyotocabinet::SpinRWLock Class Reference

Lightweight reader-writer locking device. More...

#include <kcthread.h>

List of all members.

Public Member Functions

 SpinRWLock ()
 Default constructor.
 ~SpinRWLock ()
 Destructor.
void lock_writer ()
 Get the writer lock.
bool lock_writer_try ()
 Try to get the writer lock.
void lock_reader ()
 Get a reader lock.
bool lock_reader_try ()
 Try to get a reader lock.
void unlock ()
 Release the lock.
bool promote ()
 Promote a reader lock to the writer lock.
void demote ()
 Demote the writer lock to a reader lock.

Detailed Description

Lightweight reader-writer locking device.


Constructor & Destructor Documentation

Default constructor.

Destructor.


Member Function Documentation

Get the writer lock.

Try to get the writer lock.

Returns:
true on success, or false on failure.

Get a reader lock.

Try to get a reader lock.

Returns:
true on success, or false on failure.

Release the lock.

Promote a reader lock to the writer lock.

Returns:
true on success, or false on failure.

Demote the writer lock to a reader lock.