sem_wait: Use set_errno() and get_errno(). Direce access inside the OS may not be supported in the future.
This commit is contained in:
parent
487a672d76
commit
19abe47a6f
@ -106,7 +106,7 @@ int sem_wait(FAR sem_t *sem)
|
|||||||
|
|
||||||
/* Assume any errors reported are due to invalid arguments. */
|
/* Assume any errors reported are due to invalid arguments. */
|
||||||
|
|
||||||
errno = EINVAL;
|
set_errno(EINVAL);
|
||||||
|
|
||||||
if (sem)
|
if (sem)
|
||||||
{
|
{
|
||||||
@ -168,7 +168,7 @@ int sem_wait(FAR sem_t *sem)
|
|||||||
#endif
|
#endif
|
||||||
/* Add the TCB to the prioritized semaphore wait queue */
|
/* Add the TCB to the prioritized semaphore wait queue */
|
||||||
|
|
||||||
errno = 0;
|
set_errno(0);
|
||||||
up_block_task(rtcb, TSTATE_WAIT_SEM);
|
up_block_task(rtcb, TSTATE_WAIT_SEM);
|
||||||
|
|
||||||
/* When we resume at this point, either (1) the semaphore has been
|
/* When we resume at this point, either (1) the semaphore has been
|
||||||
@ -191,7 +191,7 @@ int sem_wait(FAR sem_t *sem)
|
|||||||
* race conditions.
|
* race conditions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (errno != EINTR && errno != ETIMEDOUT)
|
if (get_errno() != EINTR && get_errno() != ETIMEDOUT)
|
||||||
{
|
{
|
||||||
/* Not awakened by a signal or a timeout... We hold the semaphore */
|
/* Not awakened by a signal or a timeout... We hold the semaphore */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user