diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-12-28 15:03:12 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-12-28 15:03:12 -0600 |
commit | c90b2da560b2e70dec7daa89207c978793df8e29 (patch) | |
tree | 951f69cc675d8ef22660d530152b5c0d0cace2d9 /nuttx | |
parent | 4c228f24fdbd27e411d3fe49723908c98eb4a3d4 (diff) | |
download | nuttx-c90b2da560b2e70dec7daa89207c978793df8e29.tar.gz nuttx-c90b2da560b2e70dec7daa89207c978793df8e29.tar.bz2 nuttx-c90b2da560b2e70dec7daa89207c978793df8e29.zip |
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.
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/sched/mqueue/mq_waitirq.c | 4 | ||||
-rw-r--r-- | nuttx/sched/semaphore/Make.defs | 6 | ||||
-rw-r--r-- | nuttx/sched/semaphore/sem_waitirq.c | 17 |
3 files changed, 13 insertions, 14 deletions
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 <gnutt@nuttx.org> @@ -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 <gnutt@nuttx.org> * * 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); } - |