PatchworkOS
Loading...
Searching...
No Matches
thread.c File Reference
#include "thread.h"
#include "syscalls.h"
#include <stdlib.h>

Go to the source code of this file.

Functions

static void _thread_init (_thread_t *thread)
 
void _threading_init (void)
 
_thread_t_thread_new (_thread_entry_t entry, void *private)
 
void _thread_free (_thread_t *thread)
 
_thread_t_thread_get (tid_t id)
 

Variables

static _thread_t thread0
 
static list_t threads
 
static mtx_t mutex
 

Function Documentation

◆ _thread_free()

void _thread_free ( _thread_t thread)

Definition at line 61 of file thread.c.

References _thread_t::entry, free(), list_remove(), mtx_lock(), mtx_unlock(), mutex, thread0, and threads.

Referenced by thrd_exit(), and thrd_join().

◆ _thread_get()

_thread_t * _thread_get ( tid_t  id)

Definition at line 72 of file thread.c.

References _thread_t::id, LIST_FOR_EACH, mtx_lock(), mtx_unlock(), mutex, NULL, and threads.

Referenced by _errno_get(), thrd_detach(), thrd_exit(), and thrd_join().

◆ _thread_init()

static void _thread_init ( _thread_t thread)
static

◆ _thread_new()

◆ _threading_init()

void _threading_init ( void  )

Variable Documentation

◆ mutex

mtx_t mutex
static

Definition at line 9 of file thread.c.

Referenced by _thread_free(), _thread_get(), _thread_new(), and _threading_init().

◆ thread0

_thread_t thread0
static

Definition at line 6 of file thread.c.

Referenced by _thread_free(), and _threading_init().

◆ threads

list_t threads
static