From bee3640829bf9cf05f48e81bc438c34d859b7bb4 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 19 Nov 2014 09:49:11 -0600 Subject: [PATCH] Simplifed semaphore wait logic in poll() --- fs/vfs/fs_poll.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/fs/vfs/fs_poll.c b/fs/vfs/fs_poll.c index 7a5de16264..26f1ebd215 100644 --- a/fs/vfs/fs_poll.c +++ b/fs/vfs/fs_poll.c @@ -74,22 +74,16 @@ static int poll_semtake(FAR sem_t *sem) { /* Take the semaphore (perhaps waiting) */ - while (sem_wait(sem) < 0) + if (sem_wait(sem) < 0) { int err = get_errno(); - /* The only case that an error should occur here is if the wait was + /* The only case that an error should occur here is if the wait were * awakened by a signal. */ - ASSERT(err == EINTR); - - /* Received signal, break from poll wait. */ - - if (err == EINTR) - { - return -EINTR; - } + DEBUGASSERT(err == EINTR); + return -err; } return OK;