pandemonium_engine/doc/classes/RWLock.xml

57 lines
2.4 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<class name="RWLock" inherits="Reference" version="4.3">
<brief_description>
A Read Write Lock.
</brief_description>
<description>
A Read Write Lock. This is used to synchronize multiple [Thread]s. This guarantees that only one thread can ever acquire the write lock at a time, and gives any number of threads read access in the meantime. An RWLock can be used to protect a critical section; however, be careful to avoid deadlocks.
</description>
<tutorials>
</tutorials>
<methods>
<method name="read_lock">
<return type="void" />
<description>
Locks this [RWLock] for read access, blocks until it is unlocked by the current owner.
[b]Note:[/b] This function returns without blocking if the thread already has ownership of the rwlock.
</description>
</method>
<method name="read_try_lock">
<return type="int" enum="Error" />
<description>
Tries locking this [RWLock] for read access, but does not block. Returns [constant OK] on success, [constant ERR_BUSY] otherwise.
[b]Note:[/b] This function returns [constant OK] if the thread already has ownership of the rwlock.
</description>
</method>
<method name="read_unlock">
<return type="void" />
<description>
Unlocks this [RWLock] for read access, leaving it to other threads.
[b]Note:[/b] If a thread called [method lock] or [method try_lock] multiple times while already having ownership of the rwlock, it must also call [method unlock] the same number of times in order to unlock it correctly.
</description>
</method>
<method name="write_lock">
<return type="void" />
<description>
Locks this [RWLock] for write access, blocks until it is unlocked by the current owner.
[b]Note:[/b] This function will deadlock if the thread already has ownership of the rwlock!
</description>
</method>
<method name="write_try_lock">
<return type="int" enum="Error" />
<description>
Tries locking this [RWLock] for write access, but does not block. Returns [constant OK] on success, [constant ERR_BUSY] otherwise.
[b]Note:[/b] This function returns [constant ERR_BUSY] if the thread already has ownership of the rwlock.
</description>
</method>
<method name="write_unlock">
<return type="void" />
<description>
Unlocks this [RWLock] for write access, leaving it to other threads.
</description>
</method>
</methods>
<constants>
</constants>
</class>