reactor-c
C Runtime for Lingua Franca
|
#include "low_level_platform.h"
#include "platform/lf_POSIX_threads_support.h"
#include "platform/lf_unix_clock_support.h"
#include <pthread.h>
#include <errno.h>
#include <stdint.h>
#include <unistd.h>
Functions | |
int | lf_available_cores () |
Get the number of cores on the host machine. | |
int | lf_thread_create (lf_thread_t *thread, void *(*lf_thread)(void *), void *arguments) |
Helper function for creating a thread. | |
lf_thread_t | lf_thread_self () |
Return the lf_thread_t of the calling thread. | |
int | lf_thread_join (lf_thread_t thread, void **thread_return) |
int | lf_mutex_init (lf_mutex_t *mutex) |
int | lf_mutex_lock (lf_mutex_t *mutex) |
int | lf_mutex_unlock (lf_mutex_t *mutex) |
int | lf_cond_init (lf_cond_t *cond, lf_mutex_t *mutex) |
int | lf_cond_broadcast (lf_cond_t *cond) |
int | lf_cond_signal (lf_cond_t *cond) |
int | lf_cond_wait (lf_cond_t *cond) |
int | _lf_cond_timedwait (lf_cond_t *cond, instant_t wakeup_time) |
Block the current thread on the condition variable until the condition variable pointed by "cond" is signaled or the time given by wakeup_time is reached. This should not be used directly as it does not account for clock synchronization offsets. Use lf_clock_cond_timedwait
from clock.h instead.
int lf_available_cores | ( | ) |
Get the number of cores on the host machine.
int lf_cond_broadcast | ( | lf_cond_t * | cond | ) |
Wake up all threads waiting for condition variable cond.
int lf_cond_init | ( | lf_cond_t * | cond, |
lf_mutex_t * | mutex ) |
Initialize a conditional variable.
int lf_cond_signal | ( | lf_cond_t * | cond | ) |
Wake up one thread waiting for condition variable cond.
int lf_cond_wait | ( | lf_cond_t * | cond | ) |
Wait for condition variable "cond" to be signaled or broadcast. The cond->mutex is assumed to be locked when this is called.
int lf_mutex_init | ( | lf_mutex_t * | mutex | ) |
Initialize a mutex.
int lf_mutex_lock | ( | lf_mutex_t * | mutex | ) |
Lock a mutex.
int lf_mutex_unlock | ( | lf_mutex_t * | mutex | ) |
Unlock a mutex.
int lf_thread_create | ( | lf_thread_t * | thread, |
void *(* | lf_thread )(void *), | ||
void * | arguments ) |
Helper function for creating a thread.
Create a new thread, starting with execution of lf_thread getting passed arguments. The new handle is stored in thread_id.
int lf_thread_join | ( | lf_thread_t | thread, |
void ** | thread_return ) |
Make calling thread wait for termination of the thread. The exit status of the thread is stored in thread_return if thread_return is not NULL.
thread | The thread. |
thread_return | A pointer to where to store the exit status of the thread. |
lf_thread_t lf_thread_self | ( | ) |
Return the lf_thread_t of the calling thread.