UbixOS  2.0
ubthread.h File Reference
#include <sys/types.h>
#include <ubixos/sched.h>
#include <ubixos/time.h>
Include dependency graph for ubthread.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ubthread
 
struct  ubthread_cond
 
struct  ubthread_cond_list
 
struct  ubthread_list
 
struct  ubthread_mutex
 
struct  ubthread_mutex_list
 

Macros

#define LOCKED   1
 
#define UNLOCKED   0
 

Typedefs

typedef struct ubthread_condubthread_cond_t
 
typedef struct ubthread_mutexubthread_mutex_t
 
typedef struct ubthreadubthread_t
 

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 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 (struct taskStruct **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 attr)
 
int ubthread_mutex_lock (ubthread_mutex_t *mutex)
 
int ubthread_mutex_unlock (ubthread_mutex_t *mutex)
 
struct taskStructubthread_self ()
 

Macro Definition Documentation

◆ LOCKED

#define LOCKED   1

Definition at line 36 of file ubthread.h.

◆ UNLOCKED

#define UNLOCKED   0

Definition at line 37 of file ubthread.h.

Typedef Documentation

◆ ubthread_cond_t

typedef struct ubthread_cond* ubthread_cond_t

Definition at line 40 of file ubthread.h.

◆ ubthread_mutex_t

Definition at line 41 of file ubthread.h.

◆ ubthread_t

typedef struct ubthread* ubthread_t

Definition at line 39 of file ubthread.h.

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  attr 
)

Referenced by sem_init(), and sys_sem_new().

◆ 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 ( struct taskStruct **  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  attr 
)

◆ 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()

struct taskStruct* ubthread_self ( )

Definition at line 45 of file ubthread.c.

References _current.