Initializes a reader-writer lock.
#include <nks/synch.h> int NXRwLockInit ( NXRwLock_t *lock, NXHierarchy_t hierarchy, const NXLockInfo_t *info);
(IN) Points to the reader-writer lock to be initialized.
(IN) Specifies the hierarchy value to be associated with the mutex. It specifies the order in which this mutex can be acquired relative to other mutexes a context can own. If a context wants to acquire a mutex unconditionally, this value for the mutex being acquired must be greater than the value of any mutexes that the context is currently holding.
(IN) Points to the information block to be associated with the reader-writer lock.
If successful, returns zero; otherwise, returns a nonzero error code:
Mutually exclusive locks are acquired by threads on behalf of the context that they might be hosting.
Imposing strict ordering among all locks in the application that can be held by a context at the same time avoids deadlock. Hierarchy violations are checked only if the application is built with the compilation option, DEBUG and _LOCKTEST.
Nonrecursive mutexes can be implemented to work faster.
If you call NXRwLockInit on a previously initialized lock, no warning is given unless you are in DEBUG mode.