Skip to content
Snippets Groups Projects
Commit 20970888 authored by patacongo's avatar patacongo
Browse files

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
parent 51a1c457
No related branches found
No related tags found
No related merge requests found
......@@ -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). */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment