Index Index for
Section 3
Index Alphabetical
listing for I
Bottom of page Bottom of
page

imc_lkacquire(3)

NAME

imc_lkacquire - Acquires a lock from a lock set

LIBRARY

Memory Channel API library (libimc.a)

SYNOPSIS

#include <sys/imc.h> int imc_lkacquire ( imc_lkid_t lock, int index, int flag, int trylock );

PARAMETERS

lock Identifies the lock set from which the lock is to be acquired. The lock set specified by the lock parameter must previously have been allocated by a call to the imc_lkalloc() function. index Specifies the lock to be acquired. The value of the index parameter is in the range zero (0) to (count-1), where count is the value returned by the imc_lkalloc() function when it created the lock set. flag This parameter is reserved for future use by Compaq. You must set the value of this parameter to ZERO (0). trylock Specifies whether the imc_lkacquire() function should return immediately if the lock is busy or wait until it can acquire the lock. The trylock parameter contains one of the following values: IMC_LOCKWAIT Wait until the lock becomes free and then acquire the lock before returning. IMC_LOCKNOWAIT Return immediately if the lock is in use.

DESCRIPTION

The imc_lkacquire() function tries to acquire the lock specified by the index parameter from the lock set specified in the lock parameter. If the lock is in use, the function can wait until the lock becomes free, or it can immediately return without acquiring the lock. The return values for the function indicate whether the lock was successfully acquired. When a process acquires a lock, no other process executing on the cluster can acquire that lock. Waiting for busy locks to become free entails busy spinning, which has a significant effect on performance. Therefore, in the interest of overall system performance, applications should acquire locks only as they are needed and promptly release them. If a system failure occurs on a host on which a process that holds a lock is executing, all locks associated with the host are automatically released. All locks acquired by a process are automatically released when the process exits. It is illegal for a process to acquire locks recursively. If a process acquires a lock that it has already acquired and not released, an error will occur. The correct sequence is for the process to acquire the lock, release it, and then acquire it again.

RETURN VALUES

The imc_lkacquire() function returns one of the following values: IMC_SUCCESS Normal successful completion. IMC_BADLOCK Either the lock set specified by the lock parameter or the lock specified by the index parameter is out of range. IMC_BADPARM An invalid parameter was specified in the call to the imc_lkacquire function. IMC_CORRUPTLOCK An attempt was made to acquire a lock from an invalid or corrupted lock set. IMC_LOCKPRIOR The process attempted to acquire a lock that it already holds. IMC_NOLOCKGOT The imc_lkacquire() function returned without gaining ownership of the lock.

RELATED INFORMATION

Introduction: imc(3) Commands: imc_init(1), imcs(1) Functions: imc_api_init(3), imc_lkalloc(3), imc_lkdealloc(3), imc_lkrelease(3) Cluster Highly Available Applications

Index Index for
Section 3
Index Alphabetical
listing for I
Top of page Top of
page