From 19abe47a6f743a2c19480663f16448b6953ffc1d Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 31 Jul 2014 15:01:37 -0600 Subject: [PATCH] sem_wait: Use set_errno() and get_errno(). Direce access inside the OS may not be supported in the future. --- sched/sem_wait.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sched/sem_wait.c b/sched/sem_wait.c index b7d16434c0e..53e2cf21f10 100644 --- a/sched/sem_wait.c +++ b/sched/sem_wait.c @@ -106,7 +106,7 @@ int sem_wait(FAR sem_t *sem) /* Assume any errors reported are due to invalid arguments. */ - errno = EINVAL; + set_errno(EINVAL); if (sem) { @@ -168,7 +168,7 @@ int sem_wait(FAR sem_t *sem) #endif /* Add the TCB to the prioritized semaphore wait queue */ - errno = 0; + set_errno(0); up_block_task(rtcb, TSTATE_WAIT_SEM); /* 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. */ - if (errno != EINTR && errno != ETIMEDOUT) + if (get_errno() != EINTR && get_errno() != ETIMEDOUT) { /* Not awakened by a signal or a timeout... We hold the semaphore */