diff --git a/sched/pthread/pthread.h b/sched/pthread/pthread.h index b2db247d03..29f7ced306 100644 --- a/sched/pthread/pthread.h +++ b/sched/pthread/pthread.h @@ -88,8 +88,7 @@ FAR struct join_s *pthread_findjoininfo(FAR struct task_group_s *group, pid_t pid); void pthread_release(FAR struct task_group_s *group); -int pthread_sem_take(FAR sem_t *sem, FAR const struct timespec *abs_timeout, - bool intr); +int pthread_sem_take(FAR sem_t *sem, FAR const struct timespec *abs_timeout); #ifdef CONFIG_PTHREAD_MUTEX_UNSAFE int pthread_sem_trytake(sem_t *sem); #endif @@ -102,7 +101,7 @@ int pthread_mutex_trytake(FAR struct pthread_mutex_s *mutex); int pthread_mutex_give(FAR struct pthread_mutex_s *mutex); void pthread_mutex_inconsistent(FAR struct tcb_s *tcb); #else -# define pthread_mutex_take(m,abs_timeout,i) pthread_sem_take(&(m)->sem,(abs_timeout),(i)) +# define pthread_mutex_take(m,abs_timeout,i) pthread_sem_take(&(m)->sem,(abs_timeout)) # define pthread_mutex_trytake(m) pthread_sem_trytake(&(m)->sem) # define pthread_mutex_give(m) pthread_sem_give(&(m)->sem) #endif diff --git a/sched/pthread/pthread_condwait.c b/sched/pthread/pthread_condwait.c index ef375ad339..08a09ae924 100644 --- a/sched/pthread/pthread_condwait.c +++ b/sched/pthread/pthread_condwait.c @@ -107,7 +107,7 @@ int pthread_cond_wait(FAR pthread_cond_t *cond, FAR pthread_mutex_t *mutex) * or if the thread is canceled (ECANCELED) */ - status = pthread_sem_take(&cond->sem, NULL, false); + status = pthread_sem_take(&cond->sem, NULL); if (ret == OK) { /* Report the first failure that occurs */ diff --git a/sched/pthread/pthread_initialize.c b/sched/pthread/pthread_initialize.c index d8af297f27..479ad2c6d7 100644 --- a/sched/pthread/pthread_initialize.c +++ b/sched/pthread/pthread_initialize.c @@ -52,40 +52,23 @@ * * Input Parameters: * sem - The semaphore to lock or unlock - * intr - false: ignore EINTR errors when locking; true treat EINTR as - * other errors by returning the errno value * * Returned Value: * 0 on success or an errno value on failure. * ****************************************************************************/ -int pthread_sem_take(FAR sem_t *sem, FAR const struct timespec *abs_timeout, - bool intr) +int pthread_sem_take(FAR sem_t *sem, FAR const struct timespec *abs_timeout) { int ret; - if (intr) + if (abs_timeout == NULL) { - if (abs_timeout == NULL) - { - ret = nxsem_wait(sem); - } - else - { - ret = nxsem_timedwait(sem, abs_timeout); - } + ret = nxsem_wait_uninterruptible(sem); } else { - if (abs_timeout == NULL) - { - ret = nxsem_wait_uninterruptible(sem); - } - else - { - ret = nxsem_timedwait_uninterruptible(sem, abs_timeout); - } + ret = nxsem_timedwait_uninterruptible(sem, abs_timeout); } return -ret; diff --git a/sched/pthread/pthread_mutex.c b/sched/pthread/pthread_mutex.c index 5648a7ddc2..4c9ebbdb9b 100644 --- a/sched/pthread/pthread_mutex.c +++ b/sched/pthread/pthread_mutex.c @@ -166,7 +166,7 @@ int pthread_mutex_take(FAR struct pthread_mutex_s *mutex, * returns zero on success and a positive errno value on failure. */ - ret = pthread_sem_take(&mutex->sem, abs_timeout, intr); + ret = pthread_sem_take(&mutex->sem, abs_timeout); if (ret == OK) { /* Check if the holder of the mutex has terminated without