#include <stdint.h>
#include <sys/types.h>
Go to the source code of this file.
|
void | tasking_create_task (void *eip, void *cr3, char kmode, char param1_exists, void *param1_arg, char param2_exists, void *param2_arg, char isThread) |
|
void | tasking_init () |
|
char | tasking_is_privleged () |
|
pid_t | tasking_get_PID () |
|
int * | tasking_get_errno_address () |
|
pid_t | tasking_new_thread (void *start, pid_t pid, char param_exists, void *param_arg) |
|
void | tasking_exit (int code) |
|
void | tasking_block (thread_state newstate) |
|
void | tasking_unblock (pid_t pid, pid_t tid) |
|
void | tasking_yield () |
|
◆ thread_state
Represents the state of a thread
Enumerator |
---|
THREAD_RUNNING | The state of a running thread.
|
THREAD_READY | The state of a ready to run thread.
|
THREAD_EXITED | The state of an exited thread.
|
THREAD_BLOCKED | The state of a generically blocked thread.
|
◆ tasking_block()
Block the current thread & yield
- Parameters
-
newstate | The state to block it in |
◆ tasking_create_task()
void tasking_create_task |
( |
void * |
eip, |
|
|
void * |
cr3, |
|
|
char |
kmode, |
|
|
char |
param1_exists, |
|
|
void * |
param1_arg, |
|
|
char |
param2_exists, |
|
|
void * |
param2_arg, |
|
|
char |
isThread |
|
) |
| |
Create a task
- Parameters
-
eip | The start address of the task |
cr3 | The address space of the task |
kmode | Whether the task is a kernel mode task |
param1_exists | Whether param1_arg is a valid value |
param1_arg | The thread's start function first parameter |
param2_exists | Whether param2_arg is a valid value |
param2_arg | The thread's start function second parameter/ |
isThread | Whether we are creating a new process or a thread in a process. If we are creating a theead, param2_arg becomes the PID for the newly created thread, and param2_exists must be 0. |
◆ tasking_exit()
void tasking_exit |
( |
int |
code | ) |
|
Terminate the current thread If the main thread terminates, the whole process terminates.
- Note
- Currently, calling tasking_exit from any thread terminates the whole process.
- Parameters
-
code | The exit code of the thread |
◆ tasking_get_errno_address()
int* tasking_get_errno_address |
( |
| ) |
|
Get the adddress of errno for the current thread
- Returns
- The address of errno
◆ tasking_get_PID()
pid_t tasking_get_PID |
( |
| ) |
|
Get the PID of the current thread.
- Returns
- The current thread's PID
◆ tasking_init()
◆ tasking_is_privleged()
char tasking_is_privleged |
( |
| ) |
|
Check whether the current process is privleged
- Returns
- whether the current process is privleged
◆ tasking_new_thread()
pid_t tasking_new_thread |
( |
void * |
start, |
|
|
pid_t |
pid, |
|
|
char |
param_exists, |
|
|
void * |
param_arg |
|
) |
| |
Create a new thread
- Parameters
-
start | The start address of the task |
pid | The PID that gets the new thread |
param_exists | Whether param_arg is a valid value |
param_arg | The thread's start function parameter |
- Returns
- the TID of the thread
◆ tasking_unblock()
void tasking_unblock |
( |
pid_t |
pid, |
|
|
pid_t |
tid |
|
) |
| |
Unblock a thread
- Parameters
-
pid | The PID that contains the thread to unblock |
tid | The TID in the process to unblock. |
◆ tasking_yield()
Yield to the next ready thread in any process