summaryrefslogtreecommitdiff
path: root/nuttx/sched/sem_wait.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-03-10 00:17:29 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-03-10 00:17:29 +0000
commitaf447e106c50246185a2b666900022043636d418 (patch)
tree3da31331ea2df513646279912b4e4b1b4d22fdb0 /nuttx/sched/sem_wait.c
parent713a462159cc5bb7e4574be4494d4e88024f010f (diff)
downloadpx4-nuttx-af447e106c50246185a2b666900022043636d418.tar.gz
px4-nuttx-af447e106c50246185a2b666900022043636d418.tar.bz2
px4-nuttx-af447e106c50246185a2b666900022043636d418.zip
Fix IRQ-related bugs, fix serial read logic, add fgets
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@51 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched/sem_wait.c')
-rw-r--r--nuttx/sched/sem_wait.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/nuttx/sched/sem_wait.c b/nuttx/sched/sem_wait.c
index 7893b39ba..4d82dd41a 100644
--- a/nuttx/sched/sem_wait.c
+++ b/nuttx/sched/sem_wait.c
@@ -103,6 +103,15 @@ int sem_wait(sem_t *sem)
int ret = ERROR;
irqstate_t saved_state;
+ /* This API should not be called from interrupt handlers */
+
+ if (up_interrupt_context())
+ {
+ /* We do not want to set the errno in this case */
+
+ return ERROR;
+ }
+
/* Assume any errors reported are due to invalid arguments. */
*get_errno_ptr() = EINVAL;