Turi Create
4.0
|
#include <core/parallel/deferred_rwlock.hpp>
Public Member Functions | |
bool | writelock_priority (request *I) |
bool | writelock (request *I) |
void | complete_wrlock () |
size_t | complete_rdlock (request *&released) |
size_t | wrunlock (request *&released) |
size_t | readlock (request *I, request *&released) |
size_t | readlock_priority (request *I, request *&released) |
size_t | rdunlock (request *&released) |
The deferred rwlock is a variant of a regular rwlock which is completely non-blocking.
The user creates request objects:
After which, all lock acquisition / release operations return a released argument. For instance, to acquire a readlock
or to complete a readlock:
All operations are non-blocking, meaning that the lock request you issued/completed, need not be the set of requests that are satisfied. The set of released locks returned is a linked list of locks that are satisfied at completion of the operation.
For instance:
This deferred_rwlock is tricky and not easy to use. You need to manage the request objects carefully and it is easy to get into inconsistent scenarios.
Definition at line 90 of file deferred_rwlock.hpp.
|
inline |
completes the read lock on the head. lock must be acquired head must be a read lock
Definition at line 204 of file deferred_rwlock.hpp.
|
inline |
completes the write lock on the head. lock must be acquired head must be a write lock
Definition at line 192 of file deferred_rwlock.hpp.
|
inline |
Released a currently acquired read lock. Returns the number of new locks acquired, and the output argument 'released' contains a linked list of locks next acquired,
Definition at line 336 of file deferred_rwlock.hpp.
|
inline |
Tries to acquire a readlock. Returns the number of locks now released. 'released' contains a linked list of locks next acquired,
Definition at line 276 of file deferred_rwlock.hpp.
|
inline |
Tries to acquire a high priority readlock. Returns the number of locks now released. 'released' contains a linked list of locks next acquired,
Definition at line 306 of file deferred_rwlock.hpp.
|
inline |
Tries to acquire a writelock. Returns true if the write lock is available immediately. False otherwise, in which case the request object may be returned in a released linked list via another complete lock operation.
Definition at line 170 of file deferred_rwlock.hpp.
|
inline |
Tries to acquire a high priority writelock. Returns true if the write lock is available immediately. False otherwise, in which case the request object may be returned in a released linked list via another complete lock operation.
Definition at line 147 of file deferred_rwlock.hpp.
|
inline |
Released a currently acquired write lock. Returns the number of new locks acquired, and the output argument 'released' contains a linked list of locks next acquired,
Definition at line 250 of file deferred_rwlock.hpp.