Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ unlockbinsem(3C) — CX/UX 6.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

bsemwakeup(2)

shmget(2)

shmop(2)

lockbinsem(3C)

unlockbinsem(3C)

NAME

unlockbinsem − unlock a binary semaphore

SYNOPSIS

#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/bsem.h>

int unlockbinsem (bsemid, binsem)
int bsemid;
struct binsem ∗binsem;

DESCRIPTION

Bsemid is a binary semaphore identifier obtained from a bsemget(2) call, and binsem is the address of the corresponding binary semaphore (which resides in shared memory (see shmget(2) and shmop(2))).  unlockbinsem returns with the binary semaphore unlocked.  If another process with a more favorable scheduling priority (see nice(2)) is waiting for the binary semaphore, the system will immediately schedule the other process for execution. 

unlockbinsem in conjunction with lockbinsem and clockbinsem may be used to control access to data shared by cooperating processes.  Lockbinsem or clockbinsem is invoked prior to accessing the data to gain exclusive access to the data, and unlockbinsem is invoked after accessing the data to allow other processes to access the data. 

RETURN VALUES

Upon successful completion, unlockbinsem will return a zero value.  Otherwise, a −1 is returned, and errno is set to indicate the error.  The errno returned will be that which is returned from the bsemwakeup(2) system service. 

WARNING

The unlockbinsem routine deals with structures located in user space (the binary semaphore being unlocked).  Error checking cannot occur until the routine enters the kernel via the bsemwakeup(2) system service.  In most cases, a bad binsem pointer will result in a call to the bsemwakeup(2) system service because an uninitialized data location looks like a binary semaphore with processes waiting on it (i.e.  binsem->not_wanted is set to 0). 

SEE ALSO

bsemwakeup(2), shmget(2), shmop(2), lockbinsem(3C)

CX/UX Programmer’s Reference Manual

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026