UbixOS  2.0
ubthread.c File Reference
#include <ubixos/ubthread.h>
#include <ubixos/exec.h>
#include <ubixos/sched.h>
#include <ubixos/time.h>
#include <ubixos/spinlock.h>
#include <ubixos/vitals.h>
#include <lib/kmalloc.h>
#include <lib/kprintf.h>
#include <ubixos/kpanic.h>
#include <sys/stdatomic.h>
Include dependency graph for ubthread.c:

Go to the source code of this file.

Functions

int ubthread_cond_broadcast (ubthread_cond_t *cond)
 
int ubthread_cond_destroy (ubthread_cond_t *cond)
 
int ubthread_cond_init (ubthread_cond_t *cond, const uint32_t attr)
 
int ubthread_cond_signal (ubthread_cond_t *cond)
 
int ubthread_cond_timedwait (ubthread_cond_t *cond, ubthread_mutex_t *mutex, const struct timespec *abstime)
 
int ubthread_cond_wait (ubthread_cond_t *cond, ubthread_mutex_t *mutex)
 
int ubthread_create (kTask_t **thread, const uInt32 *attr, void(*tproc)(void), void *arg)
 
int ubthread_mutex_destroy (ubthread_mutex_t *mutex)
 
int ubthread_mutex_init (ubthread_mutex_t *mutex, const uint32_t attr)
 
int ubthread_mutex_lock (ubthread_mutex_t *mutex)
 
int ubthread_mutex_unlock (ubthread_mutex_t *mutex)
 
kTask_tubthread_self ()
 

Variables

struct ubthread_cond_listconds = 0x0
 
struct ubthread_mutex_listmutex = 0x0
 

Function Documentation

◆ ubthread_cond_broadcast()

int ubthread_cond_broadcast ( ubthread_cond_t cond)

Definition at line 164 of file ubthread.c.

Referenced by sys_sem_signal().

◆ ubthread_cond_destroy()

int ubthread_cond_destroy ( ubthread_cond_t cond)

Definition at line 71 of file ubthread.c.

References kfree().

Referenced by sem_destroy().

Here is the call graph for this function:

◆ ubthread_cond_init()

int ubthread_cond_init ( ubthread_cond_t cond,
const uint32_t  attr 
)

Definition at line 49 of file ubthread.c.

References ATOMIC_VAR_INIT, ubthread_cond::id, kmalloc(), ubthread_cond::lock, and memset().

Here is the call graph for this function:

◆ ubthread_cond_signal()

int ubthread_cond_signal ( ubthread_cond_t cond)

Definition at line 157 of file ubthread.c.

◆ ubthread_cond_timedwait()

int ubthread_cond_timedwait ( ubthread_cond_t cond,
ubthread_mutex_t mutex,
const struct timespec abstime 
)

Definition at line 129 of file ubthread.c.

References FALSE, ubthread_cond::lock, mutex, sched_yield(), systemVitals, vitalsStruct::sysUptime, ubthread_mutex_lock(), and ubthread_mutex_unlock().

Here is the call graph for this function:

◆ ubthread_cond_wait()

int ubthread_cond_wait ( ubthread_cond_t cond,
ubthread_mutex_t mutex 
)

Definition at line 148 of file ubthread.c.

References ubthread_cond::lock, mutex, sched_yield(), TRUE, ubthread_mutex_lock(), and ubthread_mutex_unlock().

Here is the call graph for this function:

◆ ubthread_create()

int ubthread_create ( kTask_t **  thread,
const uInt32 attr,
void(*)(void)  tproc,
void *  arg 
)

Definition at line 83 of file ubthread.c.

References execThread().

Here is the call graph for this function:

◆ ubthread_mutex_destroy()

int ubthread_mutex_destroy ( ubthread_mutex_t mutex)

Definition at line 77 of file ubthread.c.

References kfree(), and mutex.

Referenced by sem_destroy(), and sys_mutex_free().

Here is the call graph for this function:

◆ ubthread_mutex_init()

int ubthread_mutex_init ( ubthread_mutex_t mutex,
const uint32_t  attr 
)

Definition at line 60 of file ubthread.c.

References ATOMIC_VAR_INIT, ubthread_mutex::id, kmalloc(), ubthread_mutex::lock, memset(), and mutex.

Here is the call graph for this function:

◆ ubthread_mutex_lock()

int ubthread_mutex_lock ( ubthread_mutex_t mutex)

Definition at line 88 of file ubthread.c.

References _current, taskStruct::id, kpanic(), kprintf(), ubthread_mutex::lock, mutex, ubthread_mutex::pid, and TRUE.

Referenced by sys_arch_sem_wait(), sys_mutex_lock(), sys_sem_signal(), ubthread_cond_timedwait(), and ubthread_cond_wait().

Here is the call graph for this function:

◆ ubthread_mutex_unlock()

int ubthread_mutex_unlock ( ubthread_mutex_t mutex)

Definition at line 109 of file ubthread.c.

References _current, taskStruct::id, kpanic(), kprintf(), ubthread_mutex::lock, mutex, ubthread_mutex::pid, and TRUE.

Referenced by sys_mutex_unlock(), sys_sem_signal(), ubthread_cond_timedwait(), and ubthread_cond_wait().

Here is the call graph for this function:

◆ ubthread_self()

kTask_t* ubthread_self ( )

Definition at line 45 of file ubthread.c.

References _current.

Variable Documentation

◆ conds

struct ubthread_cond_list* conds = 0x0

Definition at line 42 of file ubthread.c.

◆ mutex