IBNOS
Functions | Variables
Threads

Functions

struct threadthreadCreate (struct process *p, struct thread *original, void *eip)
 Creates a new kernel thread object. More...
 
void threadSchedule ()
 Schedules threads until all process have been terminated. More...
 
uint32_t threadWait (struct thread *t, struct object *obj, uint32_t mode)
 Makes a kernel thread object wait for some waitable object. More...
 

Variables

struct linkedList threadList = LL_INIT(threadList)
 
struct threadlastFPUthread
 

Detailed Description

Implementation of threads.

Function Documentation

◆ threadCreate()

struct thread* threadCreate ( struct process p,
struct thread original,
void *  eip 
)

Creates a new kernel thread object.

This function allocates and initializes the structure used to store a thread. If original is NULL then all task registers will be initialized to their default values, otherwise they will be duplicated from the original thread. When duplicating an existing thread all the additional arguments like the entry point are ignored.

Parameters
pPointer to the kernel process object which should contain the new thread
originalPointer to the original thread object or NULL
eipEntrypoint (EIP register) of the newly created process
Returns
Pointer to the thread kernel object

Definition at line 80 of file thread.c.

◆ threadSchedule()

void threadSchedule ( )

Schedules threads until all process have been terminated.

This is the main function which is responsible for running usermode code. It will be blocking until all processes have been terminated.

Definition at line 355 of file thread.c.

◆ threadWait()

uint32_t threadWait ( struct thread t,
struct object obj,
uint32_t  mode 
)

Makes a kernel thread object wait for some waitable object.

This function first checks if the wait object will be blocking, or if the operation continues immediately. If it is blocking it will unlink the thread from the list of runnable threads, and append it to the wait queue for the corresponding wait object.

Parameters
tPointer to the kernel thread object
objWait object
modeMode of the wait operation
Returns
INTERRUPT_CONTINUE_EXECUTION if the operation was non-blocking, otherwise INTERRUPT_YIELD

Definition at line 388 of file thread.c.

Variable Documentation

◆ lastFPUthread

struct thread* lastFPUthread

Definition at line 45 of file thread.c.

◆ threadList

struct linkedList threadList = LL_INIT(threadList)

Definition at line 44 of file thread.c.