26 #ifndef WORKER_THREAD_H_
27 #define WORKER_THREAD_H_
Representation of a thread that holds MSUs, messages, and waits on a semaphore.
void stop_worker_thread(struct worker_thread *thread)
Signals the given worker thread that it should stop execution and exit its main loop.
int enqueue_worker_timeout(struct worker_thread *thread, struct timespec *interval)
Signals that the given thread should break when waiting on its semaphore once interval time has passe...
struct timeout_list * timeouts
The times at which the sem_trywait on on the local semaphore should be released.
#define MAX_MSU_PER_THREAD
The maximum number of MSUs which can be placed on a single thread.
Control spawned threads with message queue within DeDOS.
void stop_all_worker_threads()
Signals all worker threads to stop.
An entry in the linked list of timeouts.
struct local_msu * msus[MAX_MSU_PER_THREAD]
The MSUs on the thread.
blocking_mode
Whether an MSU is blocking or non-blocking.
The structure that represents an MSU located on the local machine.
int n_msus
The number of msus on the thread.
int unregister_msu_with_thread(struct local_msu *msu)
Removes an MSU from the list of MSUs within its thread.
struct timeout_list * next
pthread_mutex_t exit_lock
Lock protecting the worker_thread::exit_signal.
int create_worker_thread(unsigned int thread_id, enum blocking_mode mode)
Starts a new worker thread with the given thread ID and pinned/unpinned status.
int register_msu_with_thread(struct local_msu *msu)
Registers an MSU as one that should be run on its assigned thread.
struct dedos_thread * thread
The underlying dedos_thread.
struct worker_thread * get_worker_thread(int id)
Structure representing any thread within DeDOS.