suds_lockstate(S)
suds_lockstate --
return the status of a spin lock
Syntax
cc . . . -lsuds
#include <sys/semaphore.h>
int suds_lockstate(struct suds_lock *lock_addr);
Description
The suds_lockstate function is used to obtain the status
of a lock at one particular instant in time. The value returned only
indicates that at the time of reading the lock, the lock was in one
particular state. There is no guarantee that the lock is still in
this state. This function is primarily intended for debugging
purposes and for allowing ASSERT statements to be included
within an application.
Return values
Upon successful completion, the function returns
SUDS_LOCK_LOCKED to indicate that the lock was held by a
process, SUDS_LOCK_UNLOCKED to indicate that the lock was
not held. Otherwise -1 is returned and errno is set
accordingly.
Diagnostics
[EINVAL]-
The specified address of the lock is not a valid lock address.
Examples
The following code shows an application using the
suds_state function to ensure that a particular lock is
held when a function is called. Although there is no guarantee that
the process executing the function is the owner of the lock, this
ASSERT does help to ensure that the lock required by the
function is correctly obtained.
function_name
{
ASSERT(suds_lockstate(&lock_name) == SUDS_LOCK_LOCKED);
.
.
.
}
See also
suds_ctrl(ADM),
suds_lockinit(S),
suds_lock(S),
suds_locktry(S),
suds_shmat(S),
suds_unlock(S)
Standards conformance
suds_state is not part of any currently supported
standard; it is an extension of AT&T System V provided by
The Santa Cruz Operation, Inc.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003