ARGOBOTS
dce6e727ffc4ca5b3ffc04cb9517c6689be51ec5
|
A Readers writer lock allows concurrent access for readers and exclusionary access for writers. More...
Typedefs | |
typedef struct ABT_rwlock_opaque * | ABT_rwlock |
Readers-writer lock handle type. More... | |
Functions | |
int | ABT_rwlock_create (ABT_rwlock *newrwlock) |
Create a new readers-writer lock. More... | |
int | ABT_rwlock_free (ABT_rwlock *rwlock) |
Free a readers-writer lock. More... | |
int | ABT_rwlock_rdlock (ABT_rwlock rwlock) |
Lock a readers-writer lock as a reader. More... | |
int | ABT_rwlock_wrlock (ABT_rwlock rwlock) |
Lock a readers-writer lock as a writer. More... | |
int | ABT_rwlock_unlock (ABT_rwlock rwlock) |
Unlock a readers-writer lock. More... | |
A Readers writer lock allows concurrent access for readers and exclusionary access for writers.
typedef struct ABT_rwlock_opaque* ABT_rwlock |
int ABT_rwlock_create | ( | ABT_rwlock * | newrwlock | ) |
Create a new readers-writer lock.
ABT_rwlock_create()
creates a new readers-writer lock and returns its handle through newrwlock
.
newrwlock
must be freed by ABT_rwlock_free()
after its use.
newrwlock
is set to ABT_RWLOCK_NULL
if an error occurs.newrwlock
is not updated if an error occurs. newrwlock
when an error occurs. ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_MEM
is returned if memory allocation fails.ABT_ERR_SYS
is returned if an error related to system calls and standard libraries occurs.newrwlock
is NULL
, the results are undefined.[out] | newrwlock | readers-writer lock handle |
int ABT_rwlock_free | ( | ABT_rwlock * | rwlock | ) |
Free a readers-writer lock.
ABT_rwlock_free()
deallocates the resource used for the readers-writer lock rwlock
and sets rwlock
to ABT_RWLOCK_NULL
.
rwlock
regardless of whether it is locked or not.ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_RWLOCK
is returned if rwlock
points to ABT_RWLOCK_NULL
.rwlock
is NULL
, the results are undefined.rwlock
, the results are undefined.rwlock
is accessed after calling this routine, the results are undefined.[in,out] | rwlock | readers-writer lock handle |
int ABT_rwlock_rdlock | ( | ABT_rwlock | rwlock | ) |
Lock a readers-writer lock as a reader.
ABT_rwlock_rdlock()
locks the readers-writer lock rwlock
as a reader. If this routine successfully returns, the caller acquires rwlock
. If rwlock
has been locked by a writer, the caller is blocked on rwlock
until rwlock
becomes available.
rwlock
may be acquired by multiple readers.
rwlock
is locked by multiple readers, ABT_rwlock_unlock()
must be called as many as the number of readers (i.e., the number of calls of ABT_rwlock_rdlock()
) to make rwlock
available to a writer.ABT_ERR_RWLOCK
is returned.rwlock
is locked by a writer. Otherwise, this routine does not switch the context of the calling ULT unless any user-defined function that is involved in this routine switch the context of the calling ULT.rwlock
is locked by a writer. Otherwise, this routine does not switch the context of the calling ULT unless any user-defined function that is involved in this routine switch the context of the calling ULT.ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_RWLOCK
is returned if rwlock
is ABT_RWLOCK_NULL
.ABT_ERR_RWLOCK
is returned if the caller is a tasklet.[in] | rwlock | readers-writer lock handle |
int ABT_rwlock_unlock | ( | ABT_rwlock | rwlock | ) |
Unlock a readers-writer lock.
ABT_rwlock_unlock()
unlocks the readers-writer lock rwlock
.
rwlock
.mutex
. Otherwise, this routine does not switch the context of the calling ULT unless any user-defined function that is involved in this routine switch the context of the calling ULT.ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_RWLOCK
is returned if rwlock
is ABT_RWLOCK_NULL
.rwlock
is not locked, the results are undefined.[in] | rwlock | readers-writer lock handle |
int ABT_rwlock_wrlock | ( | ABT_rwlock | rwlock | ) |
Lock a readers-writer lock as a writer.
ABT_rwlock_wrlock()
locks the readers-writer lock rwlock
as a writer. If this routine successfully returns, the caller acquires rwlock
. If rwlock
has been locked by either a reader or another writer, the caller is blocked on rwlock
until rwlock
becomes available.
rwlock
may be acquired by only a single writer.
ABT_ERR_RWLOCK
is returned.rwlock
is locked. Otherwise, this routine does not switch the context of the calling ULT unless any user-defined function that is involved in this routine switch the context of the calling ULT.rwlock
is locked. Otherwise, this routine does not switch the context of the calling ULT unless any user-defined function that is involved in this routine switch the context of the calling ULT.ABT_SUCCESS
is returned if this routine succeeds.ABT_ERR_INV_RWLOCK
is returned if rwlock
is ABT_RWLOCK_NULL
.ABT_ERR_RWLOCK
is returned if the caller is a tasklet.[in] | rwlock | readers-writer lock handle |