mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 23:03:27 +08:00
Fix wait loop and void cast (#24)
* Simplify EINTR/ECANCEL error handling 1. Add semaphore uninterruptible wait function 2 .Replace semaphore wait loop with a single uninterruptible wait 3. Replace all sem_xxx to nxsem_xxx * Unify the void cast usage 1. Remove void cast for function because many place ignore the returned value witout cast 2. Replace void cast for variable with UNUSED macro
This commit is contained in:
@@ -130,26 +130,8 @@ static FAR struct iob_qentry_s *iob_allocwait_qentry(void)
|
||||
* semaphore count will be incremented.
|
||||
*/
|
||||
|
||||
ret = nxsem_wait(&g_qentry_sem);
|
||||
if (ret < 0)
|
||||
{
|
||||
/* EINTR is not an error! EINTR simply means that we were
|
||||
* awakened by a signal and we should try again.
|
||||
*
|
||||
* REVISIT: Many end-user interfaces are required to return
|
||||
* with an error if EINTR is set. Most uses of this function
|
||||
* is in internal, non-user logic. But are there cases where
|
||||
* the error should be returned.
|
||||
*/
|
||||
|
||||
if (ret == -EINTR)
|
||||
{
|
||||
/* Force a success indication so that we will continue looping. */
|
||||
|
||||
ret = OK;
|
||||
}
|
||||
}
|
||||
else
|
||||
ret = nxsem_wait_uninterruptible(&g_qentry_sem);
|
||||
if (ret >= 0)
|
||||
{
|
||||
/* When we wake up from wait successfully, an I/O buffer chain container was
|
||||
* freed and we hold a count for one IOB. Unless somehting
|
||||
|
||||
Reference in New Issue
Block a user