sched: Replace pthread_sem_take with nxsem_wait_uninterruptible

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-05-10 13:45:09 +08:00 committed by Petro Karashchenko
parent 0fee5a2b84
commit 08002a0a38
4 changed files with 7 additions and 7 deletions

View File

@ -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)
{

View File

@ -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);

View File

@ -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)
{

View File

@ -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