DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

suds_lockinit(S)


suds_lockinit -- initialize a spin lock

Syntax

cc . . . -lsuds
#include <sys/semaphore.h>

int suds_lockinit(struct *suds_lock lock_addr);

Description

The suds_lockinit function is used to initialize a lock structure prior to that structure being used by the suds family of functions.

The lock specified by lock_addr will be set to the unlocked state, so that the first attempt to obtain that lock in the future will succeed. A lock should only be initialized once. A process, or any of its parents, must have used the suds_lockinit function prior to using the functions suds_lock(S), suds_unlock(S), or suds_locktry(S). If a process needs to call suds_lockinit without specifying a lock, so as to fulfill this requirement, then a NULL pointer may be specified as the address of a lock.

Return values

Upon successful completion, the function returns 0. Otherwise -1 is returned and errno set accordingly.

Diagnostics


[EINVAL]
The specified address of the lock is not a valid lock address.

Examples

The following code shows an application initializing a lock, prior to using the lock primitives:
   struct suds_lock lock_all;
   .
   .
   .
   suds_lockinit(&lock_all);
   .
   .
   .
   suds_lock(&lock_all);
The second example shows code fragment where a process wishes to use locks that have already been initialized by other processes:
   suds_lockinit(NULL);
   .
   .
   .
   suds_lock(&lock_all);
The suds family of calls cannot be used until the appropriate permissions have been granted using the suds_ctrl(ADM) function.

See also

suds_ctrl(ADM), suds_lock(S), suds_lockstate(S), suds_locktry(S), suds_shmat(S), suds_unlock(S)

Standards conformance

suds_lockinit 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