# 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 dependency graph for ubthread.c:

Go to the source code of this file.

## Functions

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 (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 attr)
int | ubthread_mutex_lock (ubthread_mutex_t *mutex)
int | ubthread_mutex_unlock (ubthread_mutex_t *mutex)
kTask_t * | ubthread_self ()

## Variables

ubthread_cond_list * | conds = 0x0
ubthread_mutex_list * | mutex = 0x0

## Function Documentation

int ubthread_cond_destroy | ( | ubthread_cond_t * | cond | ) |

Definition at line 64 of file ubthread.c.

References kfree().

Here is the call graph for this function:

int ubthread_cond_init | ( | ubthread_cond_t * | cond,
|  | const uInt32 | attr |
| ) |  |  |

Definition at line 48 of file ubthread.c.

References ubthread_cond::id, kmalloc(), ubthread_cond::locked, and UNLOCKED.

Here is the call graph for this function:

int ubthread_cond_signal | ( | ubthread_cond_t * | cond | ) |

Definition at line 125 of file ubthread.c.

References ubthread_cond::locked, and UNLOCKED.

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

Definition at line 105 of file ubthread.c.

References ubthread_mutex::locked, ubthread_cond::locked, mutex, sched_yield(), systemVitals, vitalsStruct::sysUptime, and UNLOCKED.

Here is the call graph for this function:

int ubthread_cond_wait | ( | ubthread_cond_t * | cond,
|  | ubthread_mutex_t * | mutex |
| ) |  |  |

Definition at line 117 of file ubthread.c.

References ubthread_mutex::locked, LOCKED, ubthread_cond::locked, mutex, sched_yield(), and UNLOCKED.

Here is the call graph for this function:

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

Definition at line 76 of file ubthread.c.

References execThread(), kmalloc(), and x2000.

Here is the call graph for this function:

int ubthread_mutex_destroy | ( | ubthread_mutex_t * | mutex | ) |

Definition at line 70 of file ubthread.c.

References kfree(), and mutex.

Here is the call graph for this function:

int ubthread_mutex_init | ( | ubthread_mutex_t * | mutex,
|  | const uInt32 | attr |
| ) |  |  |

Definition at line 56 of file ubthread.c.

References ubthread_mutex::id, kmalloc(), ubthread_mutex::locked, mutex, and UNLOCKED.

Here is the call graph for this function:

int ubthread_mutex_lock | ( | ubthread_mutex_t * | mutex | ) |

Definition at line 81 of file ubthread.c.

References _current, taskStruct::id, kprintf(), LOCKED, ubthread_mutex::locked, mutex, and ubthread_mutex::pid.

Here is the call graph for this function:

int ubthread_mutex_unlock | ( | ubthread_mutex_t * | mutex | ) |

Definition at line 92 of file ubthread.c.

References _current, taskStruct::id, ubthread_mutex::locked, mutex, ubthread_mutex::pid, and UNLOCKED.

kTask_t* ubthread_self | ( |  | ) |

Definition at line 44 of file ubthread.c.

References _current.

## Variable Documentation

struct ubthread_cond_list* conds = 0x0

Definition at line 41 of file ubthread.c.

struct ubthread_mutex_list* mutex = 0x0

Definition at line 42 of file ubthread.c.

Referenced by ubthread_cond_timedwait(), ubthread_cond_wait(), ubthread_mutex_destroy(), ubthread_mutex_init(), ubthread_mutex_lock(), and ubthread_mutex_unlock().