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:
Xiang Xiao
2020-01-02 10:49:34 -06:00
committed by Gregory Nutt
parent 316675f4db
commit 6a3c2aded6
1602 changed files with 6311 additions and 10874 deletions
+2 -20
View File
@@ -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