Remove intr param from pthread_sem_take

This commit is contained in:
Marco Casaroli 2022-12-07 11:47:08 +01:00 committed by Xiang Xiao
parent e2b00a9fcc
commit 4cc7f3747c
4 changed files with 8 additions and 26 deletions

View File

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

View File

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

View File

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

View File

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