DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

suds_lockinit(S-osr5)


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-osr5), suds_unlock(S-osr5), or suds_locktry(S-osr5). 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-osr5), suds_lockstate(S-osr5), suds_locktry(S-osr5), suds_shmat(S-osr5), suds_unlock(S-osr5)

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.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005