Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

semaphores.h File Reference

Wrappers around the sem* functions. More...

Go to the source code of this file.

Defines

#define CF_SEM_LOCK(id, sem)   (cf_sem_pv(id,-1,sem))
#define CF_SEM_DOWN(id, sem)   (cf_sem_pv(id,-1,sem))
#define CF_SEM_UNLOCK(id, sem)   (cf_sem_pv(id,1,sem))
#define CF_SEM_UP(id, sem)   (cf_sem_pv(id,1,sem))
#define CF_SEM_WAITZERO(id, sem)   (cf_sem_pv(id,0,sem))

Functions

int cf_sem_pv (int id, int operation, int semnum)
 This function performs semaphore operations.

int cf_sem_getval (int id, int semnum, int num, unsigned short *val)


Detailed Description

Wrappers around the sem* functions.

Author:
Christian Kruse, <cjk@wwwtech.de>
This module provides some wrapper functions for the semaphore functions provided by POSIX. These functions make the handling of semaphores much easier

Definition in file semaphores.h.


Define Documentation

#define CF_SEM_DOWN id,
sem   )     (cf_sem_pv(id,-1,sem))
 

This macro decreases the value of a semaphore by 1

Definition at line 40 of file semaphores.h.

#define CF_SEM_LOCK id,
sem   )     (cf_sem_pv(id,-1,sem))
 

This macro decreases the value of the semaphore by 1 (equivalent to the P() action)

Definition at line 35 of file semaphores.h.

#define CF_SEM_UNLOCK id,
sem   )     (cf_sem_pv(id,1,sem))
 

This macro increases the value of the semaphore by 1 (equivalent to the V() action)

Definition at line 45 of file semaphores.h.

#define CF_SEM_UP id,
sem   )     (cf_sem_pv(id,1,sem))
 

This macro increases the value of the semaphore by 1

Definition at line 50 of file semaphores.h.

#define CF_SEM_WAITZERO id,
sem   )     (cf_sem_pv(id,0,sem))
 

This macro blocks until the specified semaphore has reached a zero value

Definition at line 55 of file semaphores.h.


Function Documentation

int cf_sem_getval int  id,
int  semnum,
int  num,
unsigned short *  val
 

This function returns the value of the selected semaphore

Parameters:
id The semaphore ide
semnum The semaphore index in the set
num The number of semaphores in the set
val Reference to a integer variable where to store the value
Returns:
0 on success, -1 on failure

Definition at line 55 of file semaphores.c.

int cf_sem_pv int  id,
int  operation,
int  semnum
 

This function performs semaphore operations.

Parameters:
id The semaphore id
operation The size to increase or decrease the value of the semaphore.
semnum The index of the semaphore in the set.
Returns:
0 on success, -1 on failure

Definition at line 46 of file semaphores.c.


Generated on Sun Apr 25 16:37:39 2004 for Classic Forum by doxygen 1.3.5