|
cu
|
Structure for wrapping a generic object with a mutex. More...
#include <pthread.h>Go to the source code of this file.
Data Structures | |
| struct | mutex_t |
| struct | thread_t |
Functions | |
| mutex_t | cu_mutex_new (void *inner) |
| Initialize a CU mutex. More... | |
| void | cu_mutex_del (mutex_t *mutex, void(*del)(void *)) |
| Destroy a cu mutex_t object and the data. More... | |
| void * | cu_lock (mutex_t *mutex) |
| lock the mutex and get access to the data More... | |
| void | cu_unlock (mutex_t *mutex) |
| Unlock a mutex_t object. More... | |
| thread_t | cu_thread_new (void *(*handle)(), void *args) |
| Create a thread_t structur. More... | |
| void | cu_spawn (thread_t *thread) |
| Spawn a new thread. More... | |
| void * | cu_join (thread_t *thread) |
| Join a thread. More... | |
| void | mutex_init (pthread_mutex_t *restrict mutex, const pthread_mutexattr_t *restrict attr) |
| Wrapper around pthread_mutex_init() with error handling. More... | |
| void | mutex_lock (pthread_mutex_t *mutex) |
| Wrapper around pthread_mutex_lock() with error handling. More... | |
| void | mutex_unlock (pthread_mutex_t *mutex) |
| Wrapper around pthread_mutex_unlock() with error handling. More... | |
| void | mutex_destroy (pthread_mutex_t *mutex) |
| Wrapper around pthread_mutex_destroy() with error handling. More... | |
| void | thread_new (pthread_t *thread, const pthread_attr_t *attr, void *(*handle)(void *), void *arg) |
| Wrapper around pthread_thread_create() with error handling. More... | |
| void | thread_exit (void *retval) |
| Wrapper around pthread_exit() More... | |
| void | thread_join (pthread_t thread, void **retval) |
| Wrapper around pthread_join() with error handling. More... | |
| void | thread_cancel (pthread_t thread) |
| Wrapper around pthread_cancel() with error handling. More... | |
| void | attr_init (pthread_attr_t *attr) |
| void | attr_destory (pthread_attr_t *attr) |
Structure for wrapping a generic object with a mutex.
The module contains functions with dealing with thread and syncronization.
Pthread wrapper function do not have the prefix cu, they can directly be transferred to pthread calls with error checking.
| void* cu_join | ( | thread_t * | thread | ) |
Join a thread.
| thread | to join |
| void* cu_lock | ( | mutex_t * | mutex | ) |
lock the mutex and get access to the data
| mutex | mutex to lock |
| void cu_mutex_del | ( | mutex_t * | mutex, |
| void(*)(void *) | del | ||
| ) |
Destroy a cu mutex_t object and the data.
| mutex | to destroy |
| mutex_t cu_mutex_new | ( | void * | inner | ) |
Initialize a CU mutex.
| mutex | pthread mutex |
| inner | data to surround with a mutex |
| void cu_spawn | ( | thread_t * | thread | ) |
Spawn a new thread.
| thread | thread to spawn |
| thread_t cu_thread_new | ( | void *(*)() | handle, |
| void * | args | ||
| ) |
| void mutex_destroy | ( | pthread_mutex_t * | mutex | ) |
Wrapper around pthread_mutex_destroy() with error handling.
| mutex | Mutex |
| void mutex_init | ( | pthread_mutex_t *restrict | mutex, |
| const pthread_mutexattr_t *restrict | attr | ||
| ) |
Wrapper around pthread_mutex_init() with error handling.
| mutex | Mutex |
| attr | Attribute |
| void mutex_lock | ( | pthread_mutex_t * | mutex | ) |
Wrapper around pthread_mutex_lock() with error handling.
| mutex | Mutex |
| void mutex_unlock | ( | pthread_mutex_t * | mutex | ) |
Wrapper around pthread_mutex_unlock() with error handling.
| mutex | Mutex |
| void thread_cancel | ( | pthread_t | thread | ) |
Wrapper around pthread_cancel() with error handling.
| thread | Thread |
| void thread_exit | ( | void * | retval | ) |
Wrapper around pthread_exit()
| retval | Return value |
| void thread_join | ( | pthread_t | thread, |
| void ** | retval | ||
| ) |
Wrapper around pthread_join() with error handling.
| thread | Thread |
| retval | Return Value |
| void thread_new | ( | pthread_t * | thread, |
| const pthread_attr_t * | attr, | ||
| void *(*)(void *) | handle, | ||
| void * | arg | ||
| ) |
Wrapper around pthread_thread_create() with error handling.
| thread | Thread |
| attr | Attribute |
| handle | Handle Function |
| arg | Argument |