Kyoto Cabinet

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

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

kyotocabinet::SpinRWLock::SpinRWLock | ( |  | ) | `[explicit]`

Default constructor.

kyotocabinet::SpinRWLock::~SpinRWLock | ( |  | ) |

Destructor.

## Member Function Documentation

void kyotocabinet::SpinRWLock::lock_writer | ( |  | ) |

Get the writer lock.

bool kyotocabinet::SpinRWLock::lock_writer_try | ( |  | ) |

Try to get the writer lock.

Returns:
  true on success, or false on failure.

void kyotocabinet::SpinRWLock::lock_reader | ( |  | ) |

Get a reader lock.

bool kyotocabinet::SpinRWLock::lock_reader_try | ( |  | ) |

Try to get a reader lock.

Returns:
  true on success, or false on failure.

void kyotocabinet::SpinRWLock::unlock | ( |  | ) |

Release the lock.

bool kyotocabinet::SpinRWLock::promote | ( |  | ) |

Promote a reader lock to the writer lock.

Returns:
  true on success, or false on failure.

void kyotocabinet::SpinRWLock::demote | ( |  | ) |

Demote the writer lock to a reader lock.