Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sem_post(3) — OSF/1 X2.0-8 MIPS

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

sem_close(3)

sem_ifwait(3)

sem_open(3)

sem_wait(3)

sem_post(3)  —  Subroutines

Digital

NAME

sem_post − Release a locked binary semaphore (P1003.4/D11). 

SYNOPSIS

#include <binsem.h>

int sem_post (
binsemset_t binsemdes,
size_t binsemnum);

PARAMETERS

binsemdes Describes the binary semaphore set that is to be unlocked.  The binsemdes argument must be a valid descriptor of a binary semaphore set that has been obtained with a call to the sem_open function. 

binsemnum The index of the binary semaphore in the set referenced by binsemdes. The number must be in the range 0 to n−1, where n is the number of semaphores created with a call to the sem_mksem function. 

DESCRIPTION

The sem_post function unlocks the specified binary semaphore by performing the semaphore unlock operation on that binary semaphore. The sem_open function must be called for a binary semaphore set before you can call the locking and unlocking functions, sem_wait, sem_ifwait, and sem_post. 

If more than one process is blocked while waiting for the binary semaphore, only one process is unblocked and the state of the binary semaphore remains unchanged when the sem_post function returns. The process to be unblocked is selected according to the scheduling policies and priorities of all blocked processes. If the scheduling policy is SCHED_FIFO or SCHED_RR, the highest priority waiting process is unblocked. If more than one process of that priority is blocked, then the process that has waited the longest amount of time is unblocked. 

The sem_post function can be called from a signal-catching function. 

RETURN VALUES

On successful completion, the sem_post function returns the value 0 and performs a semaphore unlock operation, unblocking a process. 

Otherwise, the function returns the value −1 and sets errno to indicate the error. The state of the binary semaphore remains unchanged. 

ERRORS

The sem_post function fails under the following conditions:

[EAGAIN] The specified binary semaphore is already locked. 

[EINVAL] The binsemdes and binsemnum arguments do not refer to a valid binary semaphore. 

[ENOSYS] The function sem_post is not supported by this implementation. 

RELATED INFORMATION

Functions: sem_close(3), sem_ifwait(3), sem_open(3), sem_wait(3)

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