DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

suds_unlock(S-osr5)


suds_unlock -- release a spin lock previously obtained by suds_lock or suds_try

Syntax

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

int suds_unlock(struct suds_lock *lock_addr);

Description

The suds_unlock function is used to release a lock that has been obtained by calling suds_lock(S-osr5) or suds_locktry(S-osr5). Once the lock has been released, another process will be able to obtain that lock with suds_lock or suds_try. Locks may be unlocked in a different order to that in which they were locked.

Return values

Upon successful completion, the function returns 0. 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 two locks to protect critical sections of code.
   suds_lock(&lock_1);
   /* access resource protected with lock_1 */
   suds_lock(&lock_2);
   /* access resource protected with lock_1 and lock_2 */
   suds_unlock(&lock_1);
   /* access resource protected with lock_2 */
   suds_unlock(&lock_2);

See also

suds_ctrl(ADM), suds_lockinit(S-osr5), suds_lock(S-osr5), suds_lockstate(S-osr5), suds_locktry(S-osr5), suds_shmat(S-osr5)

Standards conformance

suds_unlock 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