|
AM263x MCU+ SDK
10.00.00
|
|
Go to the documentation of this file.
67 #define CB_TSN_THREAD_NAME_SIZE 128
72 typedef struct cb_tsn_thread_attr{
83 #ifdef CB_THREAD_NON_POSIX_H
87 #include CB_THREAD_NON_POSIX_H
90 #include <semaphore.h>
93 #define CB_THREAD_T pthread_t
94 #define CB_THREAD_CREATE(th, attr, func, arg) pthread_create(th, NULL, func, arg)
95 #define CB_THREAD_JOIN pthread_join
96 #define CB_THREAD_EXIT pthread_exit
97 #define CB_THREAD_MUTEX_T pthread_mutex_t
98 #define CB_THREAD_MUTEX_LOCK pthread_mutex_lock
99 #define CB_THREAD_MUTEX_TRYLOCK pthread_mutex_trylock
100 #define CB_THREAD_MUTEX_TIMEDLOCK pthread_mutex_timedlock
101 #define CB_THREAD_MUTEX_UNLOCK pthread_mutex_unlock
102 #define CB_THREAD_MUTEX_INIT pthread_mutex_init
103 #define CB_THREAD_MUTEX_DESTROY pthread_mutex_destroy
104 #define CB_THREAD_MUTEXATTR_T pthread_mutexattr_t
105 #define CB_THREAD_MUTEXATTR_INIT pthread_mutexattr_init
106 #define CB_THREAD_MUTEXATTR_SETPSHARED pthread_mutexattr_setpshared
107 #define CB_THREAD_PROCESS_SHARED PTHREAD_PROCESS_SHARED
108 #define CB_THREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE
109 #define CB_THREAD_COND_T pthread_cond_t
110 #define CB_THREAD_COND_INIT pthread_cond_init
111 #define CB_THREAD_COND_DESTROY pthread_cond_destroy
112 #define CB_THREAD_COND_WAIT pthread_cond_wait
113 #define CB_THREAD_COND_SIGNAL pthread_cond_signal
114 #define CB_THREAD_COND_BROADCAST pthread_cond_broadcast
115 #if !defined(CB_STATIC_MUTEX_INITIALIZER) && defined(PTHREAD_MUTEX_INITIALIZER)
116 #define CB_STATIC_MUTEX_INITIALIZER(x) x=PTHREAD_MUTEX_INITIALIZER
117 #define CB_STATIC_MUTEX_CONSTRUCTOR(x)
118 #define CB_STATIC_MUTEX_DESTRUCTOR(x)
120 #define CB_SEM_T sem_t
121 #define CB_SEM_INIT sem_init
122 #define CB_SEM_GETVALUE sem_getvalue
123 #define CB_SEM_WAIT sem_wait
124 #define CB_SEM_TRYWAIT sem_trywait
125 #define CB_SEM_TIMEDWAIT sem_timedwait
126 #define CB_SEM_POST sem_post
127 #define CB_SEM_DESTROY sem_destroy
128 #define CB_SEM_OPEN sem_open
129 #define CB_SEM_CLOSE sem_close
130 #define CB_SEM_UNLINK sem_unlink
131 #define CB_SEM_FAILED SEM_FAILED
135 int stack_size,
const char* name)
137 if(!attr) {
return -1;}
139 if(pri>0){attr->
pri=pri;}
140 if(stack_size>0){attr->
stack_size=stack_size;}
161 typedef struct cb_waitpoint {
202 if(((uint64_t)(time-wp->
time)<((uint64_t)1<<63))){
233 #define cb_waitpoint_wakeup(wp) CB_THREAD_COND_SIGNAL(&(wp)->condition)
241 #define cb_waitpoint_broadcast(wp) CB_THREAD_COND_BROADCAST(&(wp)->condition)
247 #define cb_waitpoint_lock(wp) CB_THREAD_MUTEX_LOCK(&(wp)->lock)
253 #define cb_waitpoint_unlock(wp) CB_THREAD_MUTEX_UNLOCK(&(wp)->lock)
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.
Definition: cb_thread.h:219
#define CB_THREAD_MUTEX_DESTROY
Definition: cb_thread.h:103
#define CB_THREAD_COND_DESTROY
Definition: cb_thread.h:111
uint64_t time
Definition: cb_thread.h:166
#define CB_TSN_THREAD_NAME_SIZE
data structure for thread attributes
Definition: cb_thread.h:67
Wait points that blocks the execution of a thread at a specific code point until an event occurs.
Definition: cb_thread.h:161
CB_THREAD_COND_T condition
Definition: cb_thread.h:164
#define CB_THREAD_COND_T
Definition: cb_thread.h:109
CB_THREAD_MUTEX_T lock
Definition: cb_thread.h:162
#define CB_THREAD_COND_WAIT
Definition: cb_thread.h:112
unibase general global header
#define CB_THREAD_MUTEX_INIT
Definition: cb_thread.h:102
int stack_size
Definition: cb_thread.h:75
bool wakeup
Definition: cb_thread.h:168
int ub_strncpy(char *dest, const char *src, int maxlen)
copy a string
static bool cb_waitpoint_check(cb_waitpoint_t *wp, uint64_t time)
Wait point check.
Definition: cb_thread.h:198
char name[CB_TSN_THREAD_NAME_SIZE]
Definition: cb_thread.h:77
static void cb_waitpoint_init(cb_waitpoint_t *wp)
Wait point initialization.
Definition: cb_thread.h:176
#define CB_THREAD_COND_INIT
Definition: cb_thread.h:110
void * stack_addr
Definition: cb_thread.h:79
static void cb_waitpoint_deinit(cb_waitpoint_t *wp)
Wait point de-initialization.
Definition: cb_thread.h:187
static int cb_tsn_thread_attr_init(cb_tsn_thread_attr_t *attr, int pri, int stack_size, const char *name)
Definition: cb_thread.h:134
#define CB_THREAD_MUTEX_T
Definition: cb_thread.h:97
parameters to initialize thread
Definition: cb_thread.h:72
int pri
Definition: cb_thread.h:73
static int cb_tsn_thread_attr_set_stackaddr(cb_tsn_thread_attr_t *attr, void *stack_addr)
Definition: cb_thread.h:147