|
Zero
0.1.0
|
A multiple-reader/single-writer lock based on pthreads (blocking) More...
#include <latches.h>
Public Member Functions | |
| occ_rwlock () | |
| ~occ_rwlock () | |
| void | acquire_read () |
| The normal way to acquire a read lock. More... | |
| void | release_read () |
| The normal way to release a read lock. More... | |
| void | acquire_write () |
| The normal way to acquire a write lock. More... | |
| void | release_write () |
| The normal way to release a write lock. More... | |
Private Types | |
| enum | { WRITER = 1, READER = 2 } |
Private Attributes | |
| unsigned int volatile | _active_count |
| occ_rlock | _read_lock |
| occ_wlock | _write_lock |
| pthread_mutex_t | _read_write_mutex |
| pthread_cond_t | _read_cond |
| pthread_cond_t | _write_cond |
A multiple-reader/single-writer lock based on pthreads (blocking)
Use this to protect data structures that get hammered by reads and where updates are very rare. It is used in the storage manager by the histograms (histo.cpp), and in place of some mutexen, where strict exclusion isn't required.
This lock is used in the storage manager by the checkpoint thread (the only acquire-writer) and other threads to be sure they don't do certain nasty things when a checkpoint is going on.
The idiom for using these locks is that the qnode is on a threads's stack, so the qnode implicitly identifies the owning thread.
See also: REFSYNC
| occ_rwlock::occ_rwlock | ( | ) |
| occ_rwlock::~occ_rwlock | ( | ) |
| void occ_rwlock::acquire_read | ( | ) |
The normal way to acquire a read lock.
| void occ_rwlock::acquire_write | ( | ) |
The normal way to acquire a write lock.
| void occ_rwlock::release_read | ( | ) |
The normal way to release a read lock.
| void occ_rwlock::release_write | ( | ) |
The normal way to release a write lock.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
1.8.12