26 #ifndef DEDOS_THREADS_H
27 #define DEDOS_THREADS_H
30 #include <semaphore.h>
62 typedef void* (*dedos_thread_init_fn)(
struct dedos_thread *thread);
109 #endif // DEDOS_THREADS_H
thread_mode
Identifies if a thread is pinned to a core or able to be scheduled on any core.
int exit_signal
For checking if thread should exit.
struct timespec last_metric
For logging thread metrics.
enum thread_mode mode
[un]pinned
Container for linked list message queue.
pthread_mutex_t exit_lock
For checking if thread should exit.
pthread_t pthread
The underlying pthread.
int start_dedos_thread(dedos_thread_fn thread_fn, dedos_thread_init_fn init_fn, dedos_thread_destroy_fn destroy_fn, enum blocking_mode mode, int id, struct dedos_thread *thread)
Initilizes and starts execution of a dedos_thread.
int dedos_thread_should_exit(struct dedos_thread *thread)
Returns 1 if the exit signal has been triggered, otherwise 0.
struct dedos_thread * get_dedos_thread(int id)
Returns the dedos_thread with the given ID.
int id
A unique identifier for the thread.
blocking_mode
Whether an MSU is blocking or non-blocking.
Structures and functions for enqueueing and dequeuing general-purpose messages from a queue...
void dedos_thread_stop(struct dedos_thread *thread)
Sets the exit signal for a thread, causing the main loop to quit.
void(* dedos_thread_destroy_fn)(struct dedos_thread *thread, void *init_output)
Typedef for the destructor function for a dedos_thread.
Interfaces for the creation and modification of the data-flow-graph and and general description of th...
void dedos_thread_join(struct dedos_thread *thread)
Joins and destroys the dedos_thread.
sem_t sem
Locks thread until a message is available.
int thread_wait(struct dedos_thread *thread, struct timespec *abs_timeout)
To be called from the thread, causes it to wait until a message has been received or the timeout has ...
int(* dedos_thread_fn)(struct dedos_thread *thread, void *init_output)
Typedef for the function that should be called on a dedos_thread.
struct msg_queue queue
Queue for incoming message.
void *(* dedos_thread_init_fn)(struct dedos_thread *thread)
Typedef for an initialization function for a dedos_thread.
Structure representing any thread within DeDOS.