From f4b6daff4be4eb2f29de867ecccf10b454f15d6b Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Fri, 18 May 2018 17:33:16 -0700 Subject: [PATCH] lib/posix: Port wait_q usage to new API The pthread mutex changes went in with an adaptation to build with the new wait queue API, but they did it by using the old dlist hooks directly through typecasting and union assignment. That... is sort of the opposite of the intent to having the new API be abstracted. The pthread code worked, but failed once wait queues (on x86) stopped being dlists. Simple fix once I saw the problem, anyway. Signed-off-by: Andy Ross --- include/posix/pthread.h | 2 +- lib/posix/pthread_mutex.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/posix/pthread.h b/include/posix/pthread.h index 947d58508dc..ecc3ce72a90 100644 --- a/include/posix/pthread.h +++ b/include/posix/pthread.h @@ -157,7 +157,7 @@ static inline int pthread_condattr_destroy(pthread_condattr_t *att) __in_section(_k_mutex, static, name) = \ { \ .lock_count = 0, \ - .wait_q = {SYS_DLIST_STATIC_INIT((sys_dlist_t *)&name.wait_q)}, \ + .wait_q = _WAIT_Q_INIT(&name.wait_q), \ .owner = NULL, \ } diff --git a/lib/posix/pthread_mutex.c b/lib/posix/pthread_mutex.c index 4ae08576f81..e9516724190 100644 --- a/lib/posix/pthread_mutex.c +++ b/lib/posix/pthread_mutex.c @@ -95,7 +95,7 @@ int pthread_mutex_init(pthread_mutex_t *m, m->type = mattr->type; - sys_dlist_init((sys_dlist_t *)&m->wait_q); + _waitq_init(&m->wait_q); return 0; }