mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 09:18:00 +08:00
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:
committed by
Abdelatif Guettouche
parent
e19246fe94
commit
89578b3a89
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user