cocoOS  5.0.3
os_sem.c File Reference
#include "cocoos.h"

Data Structures

struct  SemValue_t
 

Functions

void os_sem_init (void)
 
Sem_t sem_bin_create (uint8_t initial)
 
Sem_t sem_counting_create (uint8_t max, uint8_t initial)
 
uint8_t os_sem_larger_than_zero (Sem_t sem)
 
void os_sem_decrement (Sem_t sem)
 
void os_sem_increment (Sem_t sem)
 

Function Documentation

void os_sem_decrement ( Sem_t  sem)
void os_sem_increment ( Sem_t  sem)
void os_sem_init ( void  )
uint8_t os_sem_larger_than_zero ( Sem_t  sem)
Sem_t sem_bin_create ( uint8_t  initial)

Creates and initializes a new binary semaphore.

Parameters
initialvalue of the semaphore
Returns
Returns the created semaphore.
Remarks
Usage:
A semaphore is created by declaring a variable of type Sem_t and then assigning the sem_bin_create(value) return value to that variable.
1 Sem_t mySem;
2 mySem = sem_bin_create(0);
Sem_t sem_counting_create ( uint8_t  max,
uint8_t  initial 
)

Creates and initializes a new counting semaphore.

Parameters
maxvalue of the semaphore
initialvalue of the semaphore
Returns
Returns the created semaphore.
Remarks
Usage:
A semaphore is created by declaring a variable of type Sem_t and then assigning the sem_create(max, 0) return value to that variable.
1 Sem_t mySem;
2 mySem = sem_counting_create(5,0);