From c90b2da560b2e70dec7daa89207c978793df8e29 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 28 Dec 2014 15:03:12 -0600 Subject: Semaphores: sem_waitirq.c must be built when signals are disabled. That is because not handles not only the case of semaphore wait being awakened by a signal, but also the case with sem_timedwait.c when the semaphore wait is awakened by a timeout. --- nuttx/sched/mqueue/mq_waitirq.c | 4 ++-- nuttx/sched/semaphore/Make.defs | 6 +----- nuttx/sched/semaphore/sem_waitirq.c | 17 ++++++++++------- 3 files changed, 13 insertions(+), 14 deletions(-) (limited to 'nuttx/sched') diff --git a/nuttx/sched/mqueue/mq_waitirq.c b/nuttx/sched/mqueue/mq_waitirq.c index 138d1cecc..76d2e236d 100644 --- a/nuttx/sched/mqueue/mq_waitirq.c +++ b/nuttx/sched/mqueue/mq_waitirq.c @@ -1,5 +1,5 @@ /**************************************************************************** - * sched/mqueue/mq_waitirq.c + * sched/mqueue/mq_waitirq.c * * Copyright (C) 2007-2009, 2011, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -72,7 +72,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: sem_waitirq + * Name: mq_waitirq * * Description: * This function is called when a signal or a timeout is received by a diff --git a/nuttx/sched/semaphore/Make.defs b/nuttx/sched/semaphore/Make.defs index 5349d58b4..44b7e21d0 100644 --- a/nuttx/sched/semaphore/Make.defs +++ b/nuttx/sched/semaphore/Make.defs @@ -34,11 +34,7 @@ ############################################################################ CSRCS += sem_destroy.c sem_wait.c sem_trywait.c sem_timedwait.c -CSRCS += sem_post.c sem_recover.c - -ifneq ($(CONFIG_DISABLE_SIGNALS),y) -CSRCS += sem_waitirq.c -endif +CSRCS += sem_post.c sem_recover.c sem_waitirq.c ifeq ($(CONFIG_PRIORITY_INHERITANCE),y) CSRCS += sem_initialize.c sem_holder.c diff --git a/nuttx/sched/semaphore/sem_waitirq.c b/nuttx/sched/semaphore/sem_waitirq.c index 49bed13ac..5e9298f39 100644 --- a/nuttx/sched/semaphore/sem_waitirq.c +++ b/nuttx/sched/semaphore/sem_waitirq.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/semaphore/sem_waitirq.c * - * Copyright (C) 2007-2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2010, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -46,7 +46,7 @@ #include "semaphore/semaphore.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** @@ -73,10 +73,14 @@ * Name: sem_waitirq * * Description: - * This function is called when a signal is received by a task that is - * waiting on a semaphore. According to the POSIX spec, "...the calling - * thread shall not return from the call to [sem_wait] until it either - * locks the semaphore or the call is interrupted by a signal." + * This function is called when either: + * + * 1. A signal is received by a task that is waiting on a semaphore. + * According to the POSIX spec, "...the calling thread shall not return + * from the call to [sem_wait] until it either locks the semaphore or + * the call is interrupted by a signal." + * 2. From logic associated with sem_timedwait(). This function is called + * when the timeout elapses without receiving the semaphore. * * Parameters: * wtcb - A pointer to the TCB of the task that is waiting on a @@ -142,4 +146,3 @@ void sem_waitirq(FAR struct tcb_s *wtcb, int errcode) irqrestore(saved_state); } - -- cgit v1.2.3