Files | |
file | cb_thread.h |
Bindings to POSIX thread, mutex and semaphore functions. | |
Data Structures | |
struct | cb_tsn_thread_attr_t |
parameters to initialize thread More... | |
struct | cb_waitpoint_t |
Wait points that blocks the execution of a thread at a specific code point until an event occurs. More... | |
Functions | |
static int | cb_tsn_thread_attr_init (cb_tsn_thread_attr_t *attr, int pri, int stack_size, const char *name) |
static int | cb_tsn_thread_attr_set_stackaddr (cb_tsn_thread_attr_t *attr, void *stack_addr) |
static void | cb_waitpoint_init (cb_waitpoint_t *wp) |
Wait point initialization. More... | |
static void | cb_waitpoint_deinit (cb_waitpoint_t *wp) |
Wait point de-initialization. More... | |
static bool | cb_waitpoint_check (cb_waitpoint_t *wp, uint64_t time) |
Wait point check. More... | |
static void | cb_waitpoint_wakeup_at (cb_waitpoint_t *wp, uint64_t time, bool dosleep) |
Wait point blocks until wake point has been awoken and after specified time. More... | |
Macros | |
#define | CB_TSN_THREAD_NAME_SIZE 128 |
data structure for thread attributes More... | |
#define | CB_THREAD_T pthread_t |
#define | CB_THREAD_CREATE(th, attr, func, arg) pthread_create(th, NULL, func, arg) |
#define | CB_THREAD_JOIN pthread_join |
#define | CB_THREAD_EXIT pthread_exit |
#define | CB_THREAD_MUTEX_T pthread_mutex_t |
#define | CB_THREAD_MUTEX_LOCK pthread_mutex_lock |
#define | CB_THREAD_MUTEX_TRYLOCK pthread_mutex_trylock |
#define | CB_THREAD_MUTEX_TIMEDLOCK pthread_mutex_timedlock |
#define | CB_THREAD_MUTEX_UNLOCK pthread_mutex_unlock |
#define | CB_THREAD_MUTEX_INIT pthread_mutex_init |
#define | CB_THREAD_MUTEX_DESTROY pthread_mutex_destroy |
#define | CB_THREAD_MUTEXATTR_T pthread_mutexattr_t |
#define | CB_THREAD_MUTEXATTR_INIT pthread_mutexattr_init |
#define | CB_THREAD_MUTEXATTR_SETPSHARED pthread_mutexattr_setpshared |
#define | CB_THREAD_PROCESS_SHARED PTHREAD_PROCESS_SHARED |
#define | CB_THREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE |
#define | CB_THREAD_COND_T pthread_cond_t |
#define | CB_THREAD_COND_INIT pthread_cond_init |
#define | CB_THREAD_COND_DESTROY pthread_cond_destroy |
#define | CB_THREAD_COND_WAIT pthread_cond_wait |
#define | CB_THREAD_COND_SIGNAL pthread_cond_signal |
#define | CB_THREAD_COND_BROADCAST pthread_cond_broadcast |
#define | CB_SEM_T sem_t |
#define | CB_SEM_INIT sem_init |
#define | CB_SEM_GETVALUE sem_getvalue |
#define | CB_SEM_WAIT sem_wait |
#define | CB_SEM_TRYWAIT sem_trywait |
#define | CB_SEM_TIMEDWAIT sem_timedwait |
#define | CB_SEM_POST sem_post |
#define | CB_SEM_DESTROY sem_destroy |
#define | CB_SEM_OPEN sem_open |
#define | CB_SEM_CLOSE sem_close |
#define | CB_SEM_UNLINK sem_unlink |
#define | CB_SEM_FAILED SEM_FAILED |
#define | cb_waitpoint_wakeup(wp) CB_THREAD_COND_SIGNAL(&(wp)->condition) |
Wait point wakeup to signal any one thread currently at this wait point. More... | |
#define | cb_waitpoint_broadcast(wp) CB_THREAD_COND_BROADCAST(&(wp)->condition) |
Wait point wakeup to signal all threads currently at this wait point. More... | |
#define | cb_waitpoint_lock(wp) CB_THREAD_MUTEX_LOCK(&(wp)->lock) |
Wait point lock. More... | |
#define | cb_waitpoint_unlock(wp) CB_THREAD_MUTEX_UNLOCK(&(wp)->lock) |
Wait point unlock. More... | |
#define CB_TSN_THREAD_NAME_SIZE 128 |
data structure for thread attributes
#define CB_THREAD_T pthread_t |
#define CB_THREAD_CREATE | ( | th, | |
attr, | |||
func, | |||
arg | |||
) | pthread_create(th, NULL, func, arg) |
#define CB_THREAD_JOIN pthread_join |
#define CB_THREAD_EXIT pthread_exit |
#define CB_THREAD_MUTEX_T pthread_mutex_t |
#define CB_THREAD_MUTEX_LOCK pthread_mutex_lock |
#define CB_THREAD_MUTEX_TRYLOCK pthread_mutex_trylock |
#define CB_THREAD_MUTEX_TIMEDLOCK pthread_mutex_timedlock |
#define CB_THREAD_MUTEX_UNLOCK pthread_mutex_unlock |
#define CB_THREAD_MUTEX_INIT pthread_mutex_init |
#define CB_THREAD_MUTEX_DESTROY pthread_mutex_destroy |
#define CB_THREAD_MUTEXATTR_T pthread_mutexattr_t |
#define CB_THREAD_MUTEXATTR_INIT pthread_mutexattr_init |
#define CB_THREAD_MUTEXATTR_SETPSHARED pthread_mutexattr_setpshared |
#define CB_THREAD_PROCESS_SHARED PTHREAD_PROCESS_SHARED |
#define CB_THREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE |
#define CB_THREAD_COND_T pthread_cond_t |
#define CB_THREAD_COND_INIT pthread_cond_init |
#define CB_THREAD_COND_DESTROY pthread_cond_destroy |
#define CB_THREAD_COND_WAIT pthread_cond_wait |
#define CB_THREAD_COND_SIGNAL pthread_cond_signal |
#define CB_THREAD_COND_BROADCAST pthread_cond_broadcast |
#define CB_SEM_T sem_t |
#define CB_SEM_INIT sem_init |
#define CB_SEM_GETVALUE sem_getvalue |
#define CB_SEM_WAIT sem_wait |
#define CB_SEM_TRYWAIT sem_trywait |
#define CB_SEM_TIMEDWAIT sem_timedwait |
#define CB_SEM_POST sem_post |
#define CB_SEM_DESTROY sem_destroy |
#define CB_SEM_OPEN sem_open |
#define CB_SEM_CLOSE sem_close |
#define CB_SEM_UNLINK sem_unlink |
#define CB_SEM_FAILED SEM_FAILED |
#define cb_waitpoint_wakeup | ( | wp | ) | CB_THREAD_COND_SIGNAL(&(wp)->condition) |
Wait point wakeup to signal any one thread currently at this wait point.
wp | object reference to a waitpoint |
This interface should be called within and cb_waitpoint_lock/cb_waitpoint_unlock.
#define cb_waitpoint_broadcast | ( | wp | ) | CB_THREAD_COND_BROADCAST(&(wp)->condition) |
Wait point wakeup to signal all threads currently at this wait point.
wp | object reference to a waitpoint |
This interface should be called within and cb_waitpoint_lock/cb_waitpoint_unlock.
#define cb_waitpoint_lock | ( | wp | ) | CB_THREAD_MUTEX_LOCK(&(wp)->lock) |
Wait point lock.
wp | object reference to a waitpoint |
#define cb_waitpoint_unlock | ( | wp | ) | CB_THREAD_MUTEX_UNLOCK(&(wp)->lock) |
Wait point unlock.
wp | object reference to a waitpoint |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Wait point initialization.
wp | object reference to a waitpoint |
|
inlinestatic |
Wait point de-initialization.
wp | object reference to a waitpoint |
|
inlinestatic |
Wait point check.
wp | object reference to a waitpoint |
time | reference time, usually the current time |
|
inlinestatic |
Wait point blocks until wake point has been awoken and after specified time.
wp | object reference to a waitpoint |
time | reference time, usually the current time |
dosleep | whether to wait on waitpoint condition or not |
This interface should be called within and cb_waitpoint_lock, which is then automatically unlocked before entering blocking state and then automatically locked again when exiting the blocked state.