reactor-c
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
lf_semaphore.h
Go to the documentation of this file.
1/* Semaphore utility for reactor C. */
2
3
33#ifndef LF_SEMAPHORE_H
34#define LF_SEMAPHORE_H
35
36#ifndef NUMBER_OF_WORKERS
37#define NUMBER_OF_WORKERS 1
38#endif // NUMBER_OF_WORKERS
39
40#include "low_level_platform.h"
41#include <stdlib.h>
42
48
56
63void lf_semaphore_release(lf_semaphore_t* semaphore, int i);
64
71
77void lf_semaphore_wait(lf_semaphore_t* semaphore);
78
85
86#endif // LF_SEMAPHORE_H
void * lf_mutex_t
Definition lf_arduino_support.h:118
void lf_semaphore_destroy(lf_semaphore_t *semaphore)
Destroy the 'semaphore'.
Definition lf_semaphore.c:100
void lf_semaphore_wait(lf_semaphore_t *semaphore)
Wait on the 'semaphore' if count is 0.
Definition lf_semaphore.c:86
void lf_semaphore_release(lf_semaphore_t *semaphore, int i)
Release the 'semaphore' and add 'i' to its count.
Definition lf_semaphore.c:58
void lf_semaphore_acquire(lf_semaphore_t *semaphore)
Acquire the 'semaphore'. Will block if count is 0.
Definition lf_semaphore.c:71
lf_semaphore_t * lf_semaphore_new(int count)
Create a new semaphore.
Definition lf_semaphore.c:44
Platform API support for the C target of Lingua Franca.
Definition lf_POSIX_threads_support.h:41
Definition lf_semaphore.h:43
lf_cond_t cond
Definition lf_semaphore.h:46
lf_mutex_t mutex
Definition lf_semaphore.h:45
int count
Definition lf_semaphore.h:44