From 151a39425178ee628c924b8231ca65e24ee386d7 Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 28 Mar 2007 14:48:42 +0000 Subject: mq_receive/send: Return appropriate errnos and stop waiting if signal received. git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@164 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/sched/sem_wait.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'nuttx/sched/sem_wait.c') diff --git a/nuttx/sched/sem_wait.c b/nuttx/sched/sem_wait.c index cbf8fd019..b31a48fa8 100644 --- a/nuttx/sched/sem_wait.c +++ b/nuttx/sched/sem_wait.c @@ -156,11 +156,13 @@ int sem_wait(sem_t *sem) /* Add the TCB to the prioritized semaphore wait queue */ + *get_errno_ptr() = 0; up_block_task(rtcb, TSTATE_WAIT_SEM); /* When we resume at this point, either (1) the semaphore has been * assigned to this thread of execution, or (2) the semaphore wait - * has been interrupted by a signal. + * has been interrupted by a signal. We can detect the latter case + * be examining the errno value. */ if (*get_errno_ptr() != EINTR) -- cgit v1.2.3