nxsem_wait_uninterruptble: Now returns if the task is canceled.

See Issue 619.

Also removed inline functions from include/nuttx/semaphore.h.  They just cause too many problems.
This commit is contained in:
Gregory Nutt
2020-04-05 10:39:35 -06:00
committed by Abdelatif Guettouche
parent e19246fe94
commit 89578b3a89
4 changed files with 30 additions and 105 deletions
+3 -58
View File
@@ -26,7 +26,6 @@
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <errno.h>
#include <semaphore.h>
@@ -523,29 +522,13 @@ int sem_setprotocol(FAR sem_t *sem, int protocol);
* sem - Semaphore descriptor.
*
* Return Value:
* Zero(OK) - On success
* EINVAL - Invalid attempt to get the semaphore
* Zero(OK) - On success
* EINVAL - Invalid attempt to get the semaphore
* ECANCELED - May be returned if the thread is canceled while waiting.
*
****************************************************************************/
#ifdef CONFIG_HAVE_INLINE
static inline int nxsem_wait_uninterruptible(FAR sem_t *sem)
{
int ret;
do
{
/* Take the semaphore (perhaps waiting) */
ret = nxsem_wait(sem);
}
while (ret == -EINTR || ret == -ECANCELED);
return ret;
}
#else
int nxsem_wait_uninterruptible(FAR sem_t *sem);
#endif
/****************************************************************************
* Name: nxsem_timedwait_uninterruptible
@@ -570,27 +553,8 @@ int nxsem_wait_uninterruptible(FAR sem_t *sem);
*
****************************************************************************/
#ifdef CONFIG_HAVE_INLINE
static inline int
nxsem_timedwait_uninterruptible(FAR sem_t *sem,
FAR const struct timespec *abstime)
{
int ret;
do
{
/* Take the semaphore (perhaps waiting) */
ret = nxsem_timedwait(sem, abstime);
}
while (ret == -EINTR);
return ret;
}
#else
int nxsem_timedwait_uninterruptible(FAR sem_t *sem,
FAR const struct timespec *abstime);
#endif
/****************************************************************************
* Name: nxsem_tickwait_uninterruptible
@@ -619,27 +583,8 @@ int nxsem_timedwait_uninterruptible(FAR sem_t *sem,
*
****************************************************************************/
#ifdef CONFIG_HAVE_INLINE
static inline int
nxsem_tickwait_uninterruptible(FAR sem_t *sem, clock_t start,
uint32_t delay)
{
int ret;
do
{
/* Take the semaphore (perhaps waiting) */
ret = nxsem_tickwait(sem, start, delay);
}
while (ret == -EINTR);
return ret;
}
#else
int nxsem_tickwait_uninterruptible(FAR sem_t *sem, clock_t start,
uint32_t delay);
#endif
#undef EXTERN
#ifdef __cplusplus