diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-03-19 16:39:14 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-03-19 16:39:14 +0000 |
commit | ed92bb853bb946016f343ad7846d5b54a98d83e6 (patch) | |
tree | a8ebed8c1c91d6a5fc7a1584b98238783cc1ca50 | |
parent | 08bfe18bbac5abdfeec85d11897872f8d6304986 (diff) | |
download | px4-nuttx-ed92bb853bb946016f343ad7846d5b54a98d83e6.tar.gz px4-nuttx-ed92bb853bb946016f343ad7846d5b54a98d83e6.tar.bz2 px4-nuttx-ed92bb853bb946016f343ad7846d5b54a98d83e6.zip |
Keep interrupts disabled until we sample errno
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@97 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r-- | nuttx/sched/pthread_condtimedwait.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/nuttx/sched/pthread_condtimedwait.c b/nuttx/sched/pthread_condtimedwait.c index 43cd1501c..6cc6c34eb 100644 --- a/nuttx/sched/pthread_condtimedwait.c +++ b/nuttx/sched/pthread_condtimedwait.c @@ -308,7 +308,6 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, */ status = sem_wait((sem_t*)&cond->sem); - irqrestore(int_state); /* Did we get the condition semaphore. */ @@ -329,6 +328,14 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, ret = EINVAL; } } + + /* The interrupts stay disabled until after we sample the errno. + * This is because when debug is enabled and the console is used + * for debug output, then the errno can be altered by interrupt + * handling! (bad) + */ + + irqrestore(int_state); } /* Reacquire the mutex (retaining the ret). */ |