reactor-c 1.0
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
low_level_platform.h File Reference

Platform API support for the C target of Lingua Franca. More...

#include "tag.h"
#include <assert.h>
#include "platform/lf_atomic.h"

Go to the source code of this file.

Data Structures

struct  lf_scheduling_policy_t
 A struct supporting thread scheduling policies. More...

Macros

#define DEPRECATED(X)
#define LF_SCHED_MAX_PRIORITY   99
#define LF_SCHED_MIN_PRIORITY   0
#define LF_TIMEOUT   1

Enumerations

enum  lf_scheduling_policy_type_t { LF_SCHED_FAIR , LF_SCHED_TIMESLICE , LF_SCHED_PRIORITY }
 The thread scheduling policies. More...

Functions

int _lf_clock_gettime (instant_t *t)
 Get the value of an internal (and platform-specific) physical clock.
int _lf_cond_timedwait (lf_cond_t *cond, instant_t wakeup_time)
 Block the current thread on the condition variable with a timeout.
void _lf_initialize_clock (void)
 Initialize the LF clock.
int _lf_interruptable_sleep_until_locked (environment_t *env, instant_t wakeup_time)
 Sleep until the given wakeup time.
void initialize_lf_thread_id (void)
 Initialize the thread ID for the current thread.
int lf_available_cores (void)
 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.
int lf_critical_section_enter (environment_t *env)
 Enter critical section within an environment.
int lf_critical_section_exit (environment_t *env)
 Leave a critical section within an environment.
int lf_mutex_init (lf_mutex_t *mutex)
 Initialize a mutex.
int lf_mutex_lock (lf_mutex_t *mutex)
 Lock the specified mutex.
int lf_mutex_unlock (lf_mutex_t *mutex)
 Unlock the specified mutex.
int lf_nanosleep (interval_t sleep_duration)
int lf_notify_of_event (environment_t *env)
 Notify of new event.
int lf_sleep (interval_t sleep_duration)
 Pause execution for a given duration.
int lf_thread_create (lf_thread_t *thread, void *(*lf_thread)(void *), void *arguments)
 Create a new thread.
int lf_thread_id (void)
 Return the ID of the current thread.
int lf_thread_join (lf_thread_t thread, void **thread_return)
 Wait for the specified thread to exit.
lf_thread_t lf_thread_self (void)
 Return the lf_thread_t of the calling thread.
int lf_thread_set_cpu (lf_thread_t thread, size_t cpu_number)
 Pin a thread to a specific CPU.
int lf_thread_set_priority (lf_thread_t thread, int priority)
 Set the priority of a thread.
int lf_thread_set_scheduling_policy (lf_thread_t thread, lf_scheduling_policy_t *policy)
 Set the scheduling policy of a thread.

Detailed Description

Platform API support for the C target of Lingua Franca.

Author
Soroush Bateni

This file defines functions that need to be implemented for any new platform (operating system or bare-metal SDK).

This file detects the platform on which the C compiler is being run (e.g. Windows, Linux, Mac) and conditionally includes platform-specific files that define core datatypes and function signatures for Lingua Franca.

Macro Definition Documentation

◆ DEPRECATED

#define DEPRECATED ( X)
Value:
X

◆ LF_SCHED_MAX_PRIORITY

#define LF_SCHED_MAX_PRIORITY   99

◆ LF_SCHED_MIN_PRIORITY

#define LF_SCHED_MIN_PRIORITY   0

◆ LF_TIMEOUT

#define LF_TIMEOUT   1

Function Documentation

◆ lf_nanosleep()

int lf_nanosleep ( interval_t sleep_duration)