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
This commit is contained in:
patacongo 2007-03-19 16:39:14 +00:00
parent 51a1c4572a
commit 20970888b7
1 changed files with 8 additions and 1 deletions

View File

@ -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). */