92 #ifndef _CTHREAD_API_H
93 #define _CTHREAD_API_H
95 #include <sys/socket.h>
97 #include <netinet/in.h>
110 struct cthread_mutex;
112 struct cthread_barrier;
113 struct cthread_condattr;
130 #define MUTEX_RECURSIVE_ATTR 0x00000001
142 #define CTHREAD_DEFAULT_STACK_SIZE (1024 * 16)
148 #define CTHREAD_MAX_KEYS 256
154 #define CTHREAD_DESTRUCTOR_ITERATIONS 4
159 #define CTHREAD_MAX_THREADS CNE_MAX_THREADS
171 #define CTHREAD_PREALLOC 64
657 extern char __stop_per_dt;
659 #define CNE_DEFINE_PER_CTHREAD(type, name) \
660 __typeof__(type) __attribute((section("per_dt"))) per_dt_##name
665 #define CNE_DECLARE_PER_CTHREAD(type, name) \
666 extern __typeof__(type) __attribute((section("per_dt"))) per_dt_##name
670 #define CNE_PER_CTHREAD(name) \
671 ((typeof(per_dt_##name) *)((char *)cthread_get_data() + \
672 ((char *)&per_dt_##name - &__start_per_dt)))
875 const struct cthread_condattr *attr);
948 const struct timespec *abstime);
1079 const struct timespec *abstime);
CNDP_API int cthread_barrier_wait(struct cthread_barrier *b)
CNDP_API int is_cthread_running(void)
CNDP_API int cthread_setspecific(unsigned int key, const void *value)
CNDP_API struct cthread * cthread_find(struct cthread_sched *s, int threadid)
CNDP_API int cthread_barrier_destroy(struct cthread_barrier *b)
CNDP_API int cthread_cond_init(const char *name, struct cthread_cond **c, const struct cthread_condattr *attr)
CNDP_API struct cthread_sched * cthread_get_sched(struct cthread *c)
CNDP_API size_t cthread_sched_stack_size(void)
CNDP_API struct cthread_sched * cthread_sched_find(int schedid)
CNDP_API int cthread_sched_foreach(sched_cb_t func, void *arg)
CNDP_API int cthread_mutex_destroy(struct cthread_mutex *mutex)
CNDP_API int cthread_mutex_lock(struct cthread_mutex *mutex)
CNDP_API void cthread_scheduler_shutdown(int thread)
CNDP_API int cthread_foreach(struct cthread_sched *s, cthread_cb_t func, void *arg)
CNDP_API int cthread_timer_expired(struct cthread *ct)
CNDP_API int cthread_sema_wait(struct cthread_sema *s, struct cthread_mutex *m)
CNDP_API int cthread_active_schedulers(void)
CNDP_API int cthread_once(struct cthread_once *once, int(*func)(void *), void *arg)
CNDP_API int cthread_sema_timedwait(struct cthread_sema *s, struct cthread_mutex *m, const struct timespec *abstime)
CNDP_API int cthread_mutex_trylock(struct cthread_mutex *mutex)
CNDP_API void cthread_set_name(const char *f)
CNDP_API void cthread_set_data(void *data)
void(* tls_destructor_func)(void *)
CNDP_API int cthread_sched_id(struct cthread_sched *s)
CNDP_API void cthread_sleep_clks(uint64_t clks)
CNDP_API void cthread_sleep(uint64_t nsecs)
CNDP_API int cthread_join(struct cthread *ct, void **ptr)
CNDP_API void cthread_sched_stack_size_set(size_t stack_size)
CNDP_API struct cthread * cthread_current(void)
CNDP_API void * cthread_getspecific(unsigned int key)
CNDP_API int cthread_sema_flush_no_sched(struct cthread_sema *s)
CNDP_API int cthread_cond_destroy(struct cthread_cond *cond)
CNDP_API const char * cthread_get_name(struct cthread *ct)
CNDP_API int cthread_key_delete(unsigned int key)
CNDP_API void cthread_run(void)
CNDP_API int cthread_barrier_init(const char *name, struct cthread_barrier **barr, unsigned count)
CNDP_API void cthread_scheduler_shutdown_all(void)
CNDP_API void cthread_yield(void)
CNDP_API int cthread_key_create(unsigned int *key, tls_destructor_func destructor)
CNDP_API int cthread_mutex_unlock(struct cthread_mutex *mutex)
CNDP_API int cthread_cond_broadcast_no_sched(struct cthread_cond *c)
CNDP_API struct cthread * cthread_create(const char *name, cthread_func_t func, void *arg)
CNDP_API int cthread_num_schedulers_set(int num)
void(* cthread_func_t)(void *)
int(* sched_cb_t)(struct cthread_sched *s, void *arg, int idx)
CNDP_API int cthread_sema_destroy(struct cthread_sema *sema)
CNDP_API int cthread_sema_init(const char *name, struct cthread_sema **s, const struct cthread_semaattr *attr)
CNDP_API void cthread_detach(void)
CNDP_API void cthread_sleep_nsecs(uint64_t nsecs)
CNDP_API int cthread_sched_create(size_t stack_size)
CNDP_API int cthread_sema_signal(struct cthread_sema *s)
CNDP_API int cthread_sema_reset(struct cthread_sema *sema)
CNDP_API int cthread_set_thread_private(struct cthread *c, void *arg)
CNDP_API int cthread_set_affinity(int thread)
CNDP_API int cthread_cond_broadcast(struct cthread_cond *c)
CNDP_API int cthread_once_destroy(struct cthread_once *once)
int(* cthread_cb_t)(struct cthread *c, void *arg, int idx)
CNDP_API int cthread_cond_wait(struct cthread_cond *c, struct cthread_mutex *m)
CNDP_API int cthread_once_init(struct cthread_once **once)
CNDP_API int cthread_cond_timedwait(struct cthread_cond *c, struct cthread_mutex *m, const struct timespec *abstime)
CNDP_API int cthread_once_reset(struct cthread_once *once)
CNDP_API int cthread_cancel(struct cthread *ct)
CNDP_API int cthread_mutex_state(struct cthread_mutex *m)
CNDP_API void * cthread_thread_private(struct cthread *c)
CNDP_API int cthread_mutex_init(const char *name, struct cthread_mutex **mutex, const struct cthread_mutexattr *attr)
CNDP_API void cthread_exit(void *val)
CNDP_API void * cthread_get_data(void)
CNDP_API int cthread_cond_reset(struct cthread_cond *cond)
CNDP_API int cthread_cond_signal(struct cthread_cond *c)
CNDP_API void cthread_sleep_msec(uint64_t ms)
CNDP_API int cthread_sema_flush(struct cthread_sema *s)
char name[CTHREAD_NAME_SIZE]