7#ifndef ZEPHYR_INCLUDE_POSIX_PTHREAD_H_
8#define ZEPHYR_INCLUDE_POSIX_PTHREAD_H_
56#define PTHREAD_CREATE_JOINABLE PTHREAD_JOINABLE
57#define PTHREAD_CREATE_DETACHED PTHREAD_DETACHED
60#define _PTHREAD_CANCEL_POS 0
61#define PTHREAD_CANCEL_ENABLE (0U << _PTHREAD_CANCEL_POS)
62#define PTHREAD_CANCEL_DISABLE BIT(_PTHREAD_CANCEL_POS)
65#define PTHREAD_ONCE_INIT 1
76#define PTHREAD_COND_DEFINE(name) \
77 struct pthread_cond name = { \
78 .wait_q = Z_WAIT_Q_INIT(&name.wait_q), \
87 const pthread_condattr_t *att)
90 z_waitq_init(&cv->wait_q);
166#define PTHREAD_MUTEX_DEFINE(name) \
167 struct pthread_mutex name = \
170 .wait_q = Z_WAIT_Q_INIT(&name.wait_q), \
184#define PTHREAD_MUTEX_NORMAL 0
185#define PTHREAD_MUTEX_RECURSIVE 1
186#define PTHREAD_MUTEX_ERRORCHECK 2
187#define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
201#define PTHREAD_PRIO_NONE 0
246 const pthread_mutexattr_t *att);
334#define PTHREAD_BARRIER_DEFINE(name, count) \
335 struct pthread_barrier name = { \
336 .wait_q = Z_WAIT_Q_INIT(&name.wait_q), \
340#define PTHREAD_BARRIER_SERIAL_THREAD 1
355 const pthread_barrierattr_t *attr,
362 z_waitq_init(&b->wait_q);
492 void **stackaddr,
size_t *stacksize);
501 void *(*threadroutine)(
void *),
void *arg);
509 const pthread_rwlockattr_t *attr);
520 void (*destructor)(
void *));
static struct k_thread thread[2]
Definition: atomic.c:22
ZTEST_BMEM int count
Definition: main.c:33
static __attribute_const__ k_tid_t k_current_get(void)
Get thread ID of the current thread.
Definition: kernel.h:521
state
Definition: http_parser_state.h:30
static int pthread_barrierattr_destroy(pthread_barrierattr_t *b)
POSIX threading compatibility API.
Definition: pthread.h:400
int pthread_mutex_unlock(pthread_mutex_t *m)
POSIX threading compatibility API.
int pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock)
int pthread_attr_init(pthread_attr_t *attr)
int pthread_rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr)
int pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock, const struct timespec *abstime)
int pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *schedparam)
int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr, int *protocol)
POSIX threading compatibility API.
int pthread_setspecific(pthread_key_t key, const void *value)
void pthread_exit(void *retval)
static int pthread_cond_init(pthread_cond_t *cv, const pthread_condattr_t *att)
POSIX threading compatibility API.
Definition: pthread.h:86
int pthread_setcancelstate(int state, int *oldstate)
int pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate)
static int pthread_barrier_destroy(pthread_barrier_t *b)
POSIX threading compatibility API.
Definition: pthread.h:372
int pthread_attr_destroy(pthread_attr_t *attr)
int pthread_rwlock_wrlock(pthread_rwlock_t *rwlock)
static int pthread_mutexattr_init(pthread_mutexattr_t *m)
POSIX threading compatibility API.
Definition: pthread.h:284
static int pthread_condattr_destroy(pthread_condattr_t *att)
POSIX threading compatibility API.
Definition: pthread.h:152
int pthread_cond_wait(pthread_cond_t *cv, pthread_mutex_t *mut)
POSIX threading compatibility API.
static int pthread_mutexattr_destroy(pthread_mutexattr_t *m)
POSIX threading compatibility API.
Definition: pthread.h:298
static int pthread_barrier_init(pthread_barrier_t *b, const pthread_barrierattr_t *attr, unsigned int count)
POSIX threading compatibility API.
Definition: pthread.h:354
int pthread_cancel(pthread_t pthread)
int pthread_join(pthread_t thread, void **status)
static int pthread_cond_destroy(pthread_cond_t *cv)
POSIX threading compatibility API.
Definition: pthread.h:99
static int pthread_rwlockattr_init(pthread_rwlockattr_t *attr)
initialize the read-write lock attributes object.
Definition: pthread.h:475
int pthread_mutex_init(pthread_mutex_t *m, const pthread_mutexattr_t *att)
POSIX threading compatibility API.
int pthread_rwlock_destroy(pthread_rwlock_t *rwlock)
int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
int pthread_detach(pthread_t thread)
int pthread_rwlock_unlock(pthread_rwlock_t *rwlock)
int pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *type)
POSIX threading compatibility API.
int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
POSIX threading compatibility API.
static int pthread_equal(pthread_t pt1, pthread_t pt2)
Compare thread IDs.
Definition: pthread.h:455
int pthread_getname_np(pthread_t thread, char *name, size_t len)
Get name of POSIX thread and store in name buffer that is of size len.
int pthread_cond_broadcast(pthread_cond_t *cv)
POSIX threading compatibility API.
int pthread_attr_setstack(pthread_attr_t *attr, void *stackaddr, size_t stacksize)
static int pthread_condattr_init(pthread_condattr_t *att)
POSIX threading compatibility API.
Definition: pthread.h:140
static int pthread_barrierattr_init(pthread_barrierattr_t *b)
POSIX threading compatibility API.
Definition: pthread.h:386
int pthread_setname_np(pthread_t thread, const char *name)
Set name of POSIX thread.
pthread_state
Definition: pthread.h:24
@ PTHREAD_DETACHED
Definition: pthread.h:30
@ PTHREAD_JOINABLE
Definition: pthread.h:28
@ PTHREAD_EXITED
Definition: pthread.h:32
@ PTHREAD_TERMINATED
Definition: pthread.h:26
int pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock)
int pthread_mutex_timedlock(pthread_mutex_t *m, const struct timespec *abstime)
POSIX threading compatibility API.
int pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *schedparam)
static int pthread_rwlockattr_destroy(pthread_rwlockattr_t *attr)
Destroy the read-write lock attributes object.
Definition: pthread.h:465
int pthread_getschedparam(pthread_t pthread, int *policy, struct sched_param *param)
int pthread_create(pthread_t *newthread, const pthread_attr_t *attr, void *(*threadroutine)(void *), void *arg)
int pthread_rwlock_rdlock(pthread_rwlock_t *rwlock)
int pthread_mutex_trylock(pthread_mutex_t *m)
POSIX threading compatibility API.
void * pthread_getspecific(pthread_key_t key)
int pthread_rwlock_timedrdlock(pthread_rwlock_t *rwlock, const struct timespec *abstime)
int pthread_setschedparam(pthread_t pthread, int policy, const struct sched_param *param)
int pthread_cond_signal(pthread_cond_t *cv)
POSIX threading compatibility API.
int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize)
int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr, int protocol)
POSIX threading compatibility API.
int pthread_once(pthread_once_t *once, void(*initFunc)(void))
int pthread_attr_getstack(const pthread_attr_t *attr, void **stackaddr, size_t *stacksize)
int pthread_cond_timedwait(pthread_cond_t *cv, pthread_mutex_t *mut, const struct timespec *abstime)
POSIX threading compatibility API.
int pthread_key_delete(pthread_key_t key)
int pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy)
int pthread_key_create(pthread_key_t *key, void(*destructor)(void *))
static pthread_t pthread_self(void)
Obtain ID of the calling thread.
Definition: pthread.h:444
int pthread_barrier_wait(pthread_barrier_t *b)
POSIX threading compatibility API.
int pthread_mutex_destroy(pthread_mutex_t *m)
POSIX threading compatibility API.
int pthread_mutex_lock(pthread_mutex_t *m)
POSIX threading compatibility API.
struct _slist sys_slist_t
Definition: slist.h:40
static k_spinlock_key_t key
Definition: spinlock_error_case.c:14
int cancel_state
Definition: pthread.h:45
struct k_thread thread
Definition: pthread.h:36
int cancel_pending
Definition: pthread.h:46
void * retval
Definition: pthread.h:42
pthread_mutex_t state_lock
Definition: pthread.h:51
pthread_mutex_t cancel_lock
Definition: pthread.h:47
sys_slist_t key_list
Definition: pthread.h:39
pthread_cond_t state_cond
Definition: pthread.h:52
enum pthread_state state
Definition: pthread.h:50
Definition: posix_sched.h:23
Definition: _timespec.h:22