From 08002a0a38c089b1cd0d92afde6458172b1d2042 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Tue, 10 May 2022 13:45:09 +0800 Subject: [PATCH] sched: Replace pthread_sem_take with nxsem_wait_uninterruptible Signed-off-by: Xiang Xiao --- sched/pthread/pthread_completejoin.c | 4 ++-- sched/pthread/pthread_create.c | 2 +- sched/pthread/pthread_detach.c | 2 +- sched/pthread/pthread_join.c | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sched/pthread/pthread_completejoin.c b/sched/pthread/pthread_completejoin.c index 26c784f936..3d66fe8a6a 100644 --- a/sched/pthread/pthread_completejoin.c +++ b/sched/pthread/pthread_completejoin.c @@ -85,7 +85,7 @@ static bool pthread_notifywaiters(FAR struct join_s *pjoin) * value. */ - pthread_sem_take(&pjoin->data_sem, NULL, false); + nxsem_wait_uninterruptible(&pjoin->data_sem); return true; } @@ -196,7 +196,7 @@ int pthread_completejoin(pid_t pid, FAR void *exit_value) /* First, find thread's structure in the private data set. */ - pthread_sem_take(&group->tg_joinsem, NULL, false); + nxsem_wait_uninterruptible(&group->tg_joinsem); pjoin = pthread_findjoininfo(group, pid); if (!pjoin) { diff --git a/sched/pthread/pthread_create.c b/sched/pthread/pthread_create.c index 95bdbf97db..c0fd3dd5aa 100644 --- a/sched/pthread/pthread_create.c +++ b/sched/pthread/pthread_create.c @@ -569,7 +569,7 @@ int nx_pthread_create(pthread_trampoline_t trampoline, FAR pthread_t *thread, sched_lock(); if (ret == OK) { - pthread_sem_take(&ptcb->cmn.group->tg_joinsem, NULL, false); + nxsem_wait_uninterruptible(&ptcb->cmn.group->tg_joinsem); pthread_addjoininfo(ptcb->cmn.group, pjoin); pthread_sem_give(&ptcb->cmn.group->tg_joinsem); nxtask_activate((FAR struct tcb_s *)ptcb); diff --git a/sched/pthread/pthread_detach.c b/sched/pthread/pthread_detach.c index aa53973873..a519234fc1 100644 --- a/sched/pthread/pthread_detach.c +++ b/sched/pthread/pthread_detach.c @@ -72,7 +72,7 @@ int pthread_detach(pthread_t thread) /* Find the entry associated with this pthread. */ - pthread_sem_take(&group->tg_joinsem, NULL, false); + nxsem_wait_uninterruptible(&group->tg_joinsem); pjoin = pthread_findjoininfo(group, (pid_t)thread); if (!pjoin) { diff --git a/sched/pthread/pthread_join.c b/sched/pthread/pthread_join.c index 86be6f488c..682f9cd0d5 100644 --- a/sched/pthread/pthread_join.c +++ b/sched/pthread/pthread_join.c @@ -100,7 +100,7 @@ int pthread_join(pthread_t thread, FAR pthread_addr_t *pexit_value) * because it will also attempt to get this semaphore. */ - pthread_sem_take(&group->tg_joinsem, NULL, false); + nxsem_wait_uninterruptible(&group->tg_joinsem); /* Find the join information associated with this thread. * This can fail for one of three reasons: (1) There is no @@ -199,7 +199,7 @@ int pthread_join(pthread_t thread, FAR pthread_addr_t *pexit_value) * pthread to exit. */ - pthread_sem_take(&pjoin->exit_sem, NULL, false); + nxsem_wait_uninterruptible(&pjoin->exit_sem); /* The thread has exited! Get the thread exit value */ @@ -219,7 +219,7 @@ int pthread_join(pthread_t thread, FAR pthread_addr_t *pexit_value) * pthread_destroyjoin is called. */ - pthread_sem_take(&group->tg_joinsem, NULL, false); + nxsem_wait_uninterruptible(&group->tg_joinsem); } /* Pre-emption is okay now. The logic still cannot be re-entered