aryLocked

See if an array is locked

Description:

This function returns a value that indicates if the supplied ARY array has been locked for use by one or more threads. A thread can lock an array either for read-only access or for read-write access. The lock management functions (aryLock and aryUnlock) will ensure that any thread that requests and is given a read-write lock will have exclusive access to the array - no other locks of either type will be issued to other threads until the first thread releases the read-write lock using aryUnlock. If a thread requests and is given a read-only lock, the lock management functions may issue read-only locks to other threads, but it will also ensure that no other thread is granted a read-write lock until all read-only locks have been released.

Invocation

locked = aryLocked( const Ary ary, int status );

Notes:

Parameters :

ary
Pointer to the array to be checked.
status
Pointer to global status.

Returned function value

A value indicating the status of the supplied array:

0: the supplied array is unlocked. This is the condition that must be met for the current thread to be able to lock the supplied array for read-write access using function aryLock. This condition can be achieved by releasing any existing locks using aryUnlock.

1: the supplied array is locked for reading and writing by the current thread. This is the condition that must be met for the current thread to be able to use the supplied array in any ARY function that might modify the array (except for the locking and unlocking functions - see below). This condition can be achieved by calling aryLock.

2: the supplied array is locked for reading and writing by a different thread. An error will be reported if the current thread attempts to use the array in any other ARY function.

3: the supplied array is locked read-only by the current thread (and maybe other threads as well). This is the condition that must be met for the current thread to be able to use the supplied array in any ARY function that cannot modify the array. An error will be reported if the current thread attempts to use the array in any ARY function that could modify the array. This condition can be achieved by calling aryLock.

4: the supplied array is not locked by the current thread, but is locked read-only by one or more other threads. An error will be reported if the current thread attempts to use the array in any other ARY function.