MyOS Libc
tasking.h File Reference
#include <stdint.h>
#include <sys/types.h>

Go to the source code of this file.

Enumerations

enum  thread_state { THREAD_RUNNING , THREAD_READY , THREAD_EXITED , THREAD_BLOCKED }
 

Functions

void yield ()
 
void create_proc (void *start, void *address_space, void *param1, void *param2)
 
void block_thread (thread_state state)
 
void unblock_thread (pid_t pid, pid_t tid)
 
char check_proc_exists (pid_t pid)
 

Enumeration Type Documentation

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

Function Documentation

◆ block_thread()

void block_thread ( thread_state  state)

Block the current thread

Parameters
stateThe state to block it with

◆ check_proc_exists()

char check_proc_exists ( pid_t  pid)

Check if a process exists

Parameters
pidThe param of the process to check
Returns
Whether the process exists

◆ create_proc()

void create_proc ( void *  start,
void *  address_space,
void *  param1,
void *  param2 
)

Create a process

Parameters
startThe start function of the process
address_spaceThe address space of the process
param1The first parameter of the process
param2The second parameter of the process

◆ unblock_thread()

void unblock_thread ( pid_t  pid,
pid_t  tid 
)

Unblock a thread in a process

Parameters
pidThe PID of the thread's process
tidThe TID of the thread

◆ yield()

void yield ( )

Yield the CPU to another process