# ubthread.h File Reference

`#include <ubixos/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

## Defines

#define | ETIMEDOUT -1
#define | LOCKED 1
#define | UNLOCKED 0

## Typedefs

typedef ubthread_cond * | ubthread_cond_t
typedef ubthread_mutex * | ubthread_mutex_t
typedef ubthread * | ubthread_t

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

## Define Documentation

#define ETIMEDOUT -1

Definition at line 37 of file ubthread.h.

#define LOCKED 1

Definition at line 39 of file ubthread.h.

Referenced by ubthread_cond_wait(), and ubthread_mutex_lock().

#define UNLOCKED 0

Definition at line 40 of file ubthread.h.

Referenced by ubthread_cond_init(), ubthread_cond_signal(), ubthread_cond_timedwait(), ubthread_cond_wait(), ubthread_mutex_init(), and ubthread_mutex_unlock().

## Typedef Documentation

typedef struct ubthread_cond* ubthread_cond_t

Definition at line 43 of file ubthread.h.

typedef struct ubthread_mutex* ubthread_mutex_t

Definition at line 44 of file ubthread.h.

typedef struct ubthread* ubthread_t

Definition at line 42 of file ubthread.h.

## 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_cond::locked, ubthread_mutex::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_cond::locked, LOCKED, ubthread_mutex::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(), ubthread_mutex::locked, 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.