### datLocked

See if an object is locked

#### Invocation

locked = datLocked( const HDSLoc $\ast$locator, int recursive, int $\ast$status );

#### Arguments

##### locator = const HDSLoc $\ast$ (Given)
A locator for the object to be checked.
##### recursive = int (Given)
If non-zero, then all descendants of the supplied object are also checked in the same way.
##### status = int$\ast$ (Given and Returned)
Pointer to global status.

#### Notes:

• The locking performed by datLock, datUnlock and datLocked is based on POSIX threads, and has no connection with the locking referred to in hdsLock and hdsFree.

• Zero is returned as the function value if an error has already occurred, or if an error occurs in this function.

#### Returned function value

A value indicating the status of the supplied Object:
• 1: the application is is linked with a version of HDS that does not support object locking.

0: the supplied object is unlocked. If " recursive" is non-zero, then all descendant objects are also unlocked, and this is then the condition that must be met for the current thread to be able to lock the supplied object for read-write access using function datLock. This condition can be achieved by releasing any existing locks using datUnlock.

1: the supplied object 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 object in any HDS function that might modify the object (except for the locking and unlocking functions - see below). If " recursive" is non-zero, then all descendant objects are also locked for reading and writing. This condition can be achieved by calling datLock.

2: the supplied object is locked for reading and writing by a different thread. An error will be reported if the current thread attempts to use the object in any other HDS function. If " recursive" is non-zero, then either the object itself or one of its descendant objects is locked for reading and writing.

3: the supplied object is locked read-only by the current thread (and maybe other threads as well). If " recursive" is non-zero, then all descendant objects are also locked read-only by the current thread. This is the condition that must be met for the current thread to be able to use the supplied object in any HDS function that cannot modify the object. An error will be reported if the current thread attempts to use the object in any HDS function that could modify the object. This condition can be achieved by calling datLock.

4: the supplied object 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 object in any other HDS function. If " recursive" is non-zero, then all descendant objects are also locked read-only by one or more other threads.

5: Some complex mix of locked and unlocked descendants not covered by any of the above values.