reactor-c
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
scheduler_instance.h
Go to the documentation of this file.
1
12#ifndef LF_SCHEDULER_PARAMS_H
13#define LF_SCHEDULER_PARAMS_H
14
15#ifndef NUMBER_OF_WORKERS // Enable thread-related platform functions
16#define NUMBER_OF_WORKERS 1
17#endif // NUMBER_OF_WORKERS
18
19#include <stdbool.h>
20#include <stddef.h> // for size_t
21
22#define DEFAULT_MAX_REACTION_LEVEL 100
23
24// Forward declarations
25typedef struct environment_t environment_t;
27
34typedef struct lf_scheduler_t {
41
45 volatile bool should_stop;
46
53 volatile int* indexes;
54
59
64
69 volatile size_t number_of_idle_workers;
70
71 // Pointer to an optional custom data structure that each scheduler can define.
72 // The type is forward declared here and must be declared again in the scheduler source file
73 // Is not touched by `init_sched_instance` and must be initialized by each scheduler that needs it
76
96
110bool init_sched_instance(struct environment_t* env, lf_scheduler_t** instance, size_t number_of_workers,
111 sched_params_t* params);
112
113#endif // LF_SCHEDULER_PARAMS_H
struct lf_scheduler_t lf_scheduler_t
Paramters used in schedulers of the threaded reactor C runtime.
bool init_sched_instance(struct environment_t *env, lf_scheduler_t **instance, size_t number_of_workers, sched_params_t *params)
Initialize instance using the provided information.
Definition scheduler_instance.c:19
Definition scheduler_GEDF_NP.c:44
Execution environment. This struct contains information about the execution environment....
Definition environment.h:49
Paramters used in schedulers of the threaded reactor C runtime.
Definition scheduler_instance.h:34
volatile size_t number_of_idle_workers
Number of workers that are idle. Adding to/subtracting from this variable must be done atomically.
Definition scheduler_instance.h:69
size_t number_of_workers
Number of workers that this scheduler is managing.
Definition scheduler_instance.h:63
struct environment_t * env
Definition scheduler_instance.h:35
size_t max_reaction_level
Maximum number of levels for reactions in the program.
Definition scheduler_instance.h:40
volatile int * indexes
An array of atomic indexes.
Definition scheduler_instance.h:53
volatile bool should_stop
Indicate whether the program should stop.
Definition scheduler_instance.h:45
custom_scheduler_data_t * custom_data
Definition scheduler_instance.h:74
void * transfer_reactions
Hold reactions temporarily.
Definition scheduler_instance.h:58
Struct representing the most common scheduler parameters.
Definition scheduler_instance.h:92
size_t num_reactions_per_level_size
Definition scheduler_instance.h:94
size_t * num_reactions_per_level
Definition scheduler_instance.h:93