# kyotocabinet::SlottedRWLock< SLOTNUM > Class Template Reference

Slotted reader-writer lock devices. More...

`#include <kcthread.h>`

List of all members.

## Public Member Functions

| SlottedRWLock ()
| Constructor.
| ~SlottedRWLock ()
| Destructor.
void | lock_writer (int32_t idx)
| Get the writer lock of a slot.
void | lock_reader (int32_t idx)
| Get the reader lock of a slot.
void | unlock (int32_t idx)
| Release the lock of a slot.
void | lock_writer_all ()
| Get the writer locks of all slots.
void | lock_reader_all ()
| Get the reader locks of all slots.
void | unlock_all ()
| Release the locks of all slots.

## Detailed Description

### template<int32_t SLOTNUM>
class kyotocabinet::SlottedRWLock< SLOTNUM >

Slotted reader-writer lock devices.

Parameters:

  | SLOTNUM | the number of slots.

## Constructor & Destructor Documentation

template<int32_t SLOTNUM>

kyotocabinet::SlottedRWLock< SLOTNUM >::SlottedRWLock | ( |  | ) | `[explicit]`

Constructor.

template<int32_t SLOTNUM>

kyotocabinet::SlottedRWLock< SLOTNUM >::~SlottedRWLock | ( |  | ) |

Destructor.

## Member Function Documentation

template<int32_t SLOTNUM>

void kyotocabinet::SlottedRWLock< SLOTNUM >::lock_writer | ( | int32_t | idx | ) |

Get the writer lock of a slot.

Parameters:

  | idx | the index of a slot.

template<int32_t SLOTNUM>

void kyotocabinet::SlottedRWLock< SLOTNUM >::lock_reader | ( | int32_t | idx | ) |

Get the reader lock of a slot.

Parameters:

  | idx | the index of a slot.

template<int32_t SLOTNUM>

void kyotocabinet::SlottedRWLock< SLOTNUM >::unlock | ( | int32_t | idx | ) |

Release the lock of a slot.

Parameters:

  | idx | the index of a slot.

template<int32_t SLOTNUM>

void kyotocabinet::SlottedRWLock< SLOTNUM >::lock_writer_all | ( |  | ) |

Get the writer locks of all slots.

template<int32_t SLOTNUM>

void kyotocabinet::SlottedRWLock< SLOTNUM >::lock_reader_all | ( |  | ) |

Get the reader locks of all slots.

template<int32_t SLOTNUM>

void kyotocabinet::SlottedRWLock< SLOTNUM >::unlock_all | ( |  | ) |

Release the locks of all slots.