My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Classes | Functions
worker_thread.h File Reference

Threads that hold MSUs. More...

#include "dedos_threads.h"

Go to the source code of this file.

Classes

struct  timeout_list
 An entry in the linked list of timeouts. More...
 
struct  worker_thread
 Representation of a thread that holds MSUs, messages, and waits on a semaphore. More...
 

Functions

struct worker_threadget_worker_thread (int id)
 
void stop_worker_thread (struct worker_thread *thread)
 Signals the given worker thread that it should stop execution and exit its main loop. More...
 
void stop_all_worker_threads ()
 Signals all worker threads to stop. More...
 
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. More...
 
int unregister_msu_with_thread (struct local_msu *msu)
 Removes an MSU from the list of MSUs within its thread. More...
 
int register_msu_with_thread (struct local_msu *msu)
 Registers an MSU as one that should be run on its assigned thread. More...
 
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 passed. More...
 

Detailed Description

Threads that hold MSUs.

Definition in file worker_thread.h.

Function Documentation

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.

Blocks until thread has been started

Definition at line 382 of file worker_thread.c.

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 passed.

Returns
0 on success, -1 on error

Definition at line 301 of file worker_thread.c.

struct worker_thread* get_worker_thread ( int  id)
Returns
the worker thread with the given ID, or NULL if not found

Definition at line 79 of file worker_thread.c.

int register_msu_with_thread ( struct local_msu msu)

Registers an MSU as one that should be run on its assigned thread.

Returns
0 on success, -1 on error

Definition at line 119 of file worker_thread.c.

void stop_all_worker_threads ( )

Signals all worker threads to stop.

Definition at line 54 of file worker_thread.c.

void stop_worker_thread ( struct worker_thread thread)

Signals the given worker thread that it should stop execution and exit its main loop.

int unregister_msu_with_thread ( struct local_msu msu)

Removes an MSU from the list of MSUs within its thread.

Returns
0 on success, -1 on error

Definition at line 110 of file worker_thread.c.