#include <rwlock.h>
Collaboration diagram for ReadWriteLock:
Public Member Functions | |
ReadWriteLock () | |
Set up a read/write lock. | |
~ReadWriteLock () | |
Destroy a read/write lock. | |
void | ReadLock () |
Lock for reading. | |
bool | ReadTest () |
Try to lock for reading. | |
void | ReadUnlock () |
Unlock for reading. | |
void | WriteLock () |
Lock for writing. | |
bool | WriteTest () |
Try to lock for writing. | |
void | WriteUnlock () |
Unlock for writing. | |
Private Attributes | |
GStaticRWLock | l |
internally used lock structure |
Most of the time the writers should have precedence of readers. That means for this implementation, that as soon as a writer wants to lock the data, no other reader is allowed to lock the data, whereas of course the readers, that already have locked the data are allowed to finish their operation. As soon as the last reader unlocks the data, the writer will lock it. [quoted glib docu - thanks!]
Definition at line 46 of file rwlock.h.
|
Set up a read/write lock.
Definition at line 53 of file rwlock.h. References l. |
|
Destroy a read/write lock.
Definition at line 57 of file rwlock.h. References l. |
|
Lock for reading. There may be unlimited concurrent locks for reading at the same time. If the ReadWriteLock is already locked for writing by another thread or if another thread is already waiting to lock the ReadWriteLock for writing, then this function will block until the ReadWriteLock is unlocked by the other writing thread and no other writing threads want to lock the ReadWriteLock. [quoted glib docu - thanks!] This lock has to be unlocked by ReadUnlock(). Definition at line 72 of file rwlock.h. References l. |
|
Try to lock for reading. Tries to lock the ReadWriteLock for reading. If the ReadWriteLock is already locked for writing by another thread or if another thread is already waiting to lock the ReadWriteLock for writing, it immediately returns 0. Otherwise it locks the ReadWriteLock for reading and returns 1. [quoted glib docu - thanks!] This lock has to be unlocked by ReadUnlock(). Definition at line 85 of file rwlock.h. References l. |
|
Unlock for reading. For more info, see ReadLock(). Definition at line 92 of file rwlock.h. References l. |
|
Lock for writing. If the ReadWriteLock is already locked for writing or reading by other threads, this function will block until the ReadWriteLock is completely unlocked and then lock the ReadWriteLock for writing. While this functions waits to lock the ReadWriteLock, no other thread can lock the ReadWriteLock for reading. When the ReadWriteLock is locked for writing, no other thread can lock the ReadWriteLock (neither for reading nor writing). [quoted glib docu - thanks!] This lock has to be unlocked by WriteUnlock() Definition at line 108 of file rwlock.h. References l. |
|
Try to lock for writing. Tries to lock the ReadWriteLock for writing. If the ReadWriteLock is already locked (for either reading or writing) by another thread, it immediately returns 0. Otherwise it locks the ReadWriteLock for writing and returns 1. [quoted glib docu - thanks!] This lock has to be unlocked by WriteUnlock() Definition at line 121 of file rwlock.h. References l. |
|
Unlock for writing. For more info, see WriteLock(). Definition at line 128 of file rwlock.h. References l. |
|
internally used lock structure
Definition at line 49 of file rwlock.h. Referenced by ReadLock(), ReadTest(), ReadUnlock(), ReadWriteLock(), WriteLock(), WriteTest(), WriteUnlock(), and ~ReadWriteLock(). |