semaphore.h

Overview

Related Modules:

IPC

Description:

Provides functions and structures related to semaphore operations.

For example, you can use the functions to create, open, close, and delete semaphores, and perform P and V operations on semaphores.

Since:

1.0

Version:

1.0

Summary

Data Structures

Data Structure Name

Description

sem_t

Defines semaphores.

Macros

Macro Name and Value

Description

SEM_FAILED   ((sem_t *)0)

Defines the semaphore failure flag.

Functions

Function Name

Description

sem_close (sem_tsem)

int 

Closes a specified semaphore.

sem_destroy (sem_t sem)

int 

Destroys a specified anonymous semaphore that is no longer used.

sem_getvalue (sem_t__restrict sem, int restrict sval)

int 

Obtains the count value of a specified semaphore.

sem_init (sem_tsem, int pshared, unsigned int value)

int 

Creates and initializes an anonymous semaphore.

sem_post (sem_t sem)

int 

Increments the semaphore count by 1.

sem_timedwait (sem_t *restrict sem, const struct timespec__restrict timeout)

int 

Obtains the semaphore, with a timeout period specified.

sem_trywait (sem_t sem)

int 

Attempts to obtain the semaphore.

sem_unlink (const char name)

int 

Deletes a specified semaphore.

sem_wait (sem_t sem)

int 

Obtains the semaphore.