diff options
author | Paul Brook <paul@codesourcery.com> | 2006-08-22 20:48:23 +0000 |
---|---|---|
committer | Paul Brook <paul@codesourcery.com> | 2006-08-22 20:48:23 +0000 |
commit | fe28d47d3bc662651cb01c06e5078caf59442e19 (patch) | |
tree | e302fe1b89a694213624fad885b2e45ddd61a6e5 /newlib | |
parent | 5f6fc2565bb156cf0834d773dc7f2daa7cdde090 (diff) | |
download | cygnal-fe28d47d3bc662651cb01c06e5078caf59442e19.tar.gz cygnal-fe28d47d3bc662651cb01c06e5078caf59442e19.tar.bz2 cygnal-fe28d47d3bc662651cb01c06e5078caf59442e19.zip |
2006-08-22 Paul Brook <paul@codesourcery.com>
newlib/
* libc/sys/arm/syscalls.c (initialise_monitor_handles): Fix
multithreaded locking.
Diffstat (limited to 'newlib')
-rw-r--r-- | newlib/libc/sys/arm/syscalls.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/newlib/libc/sys/arm/syscalls.c b/newlib/libc/sys/arm/syscalls.c index ebbd087e4..33610c2e1 100644 --- a/newlib/libc/sys/arm/syscalls.c +++ b/newlib/libc/sys/arm/syscalls.c @@ -112,10 +112,11 @@ initialise_monitor_handles (void) #ifndef __SINGLE_THREAD__ __lock_acquire_recursive (__arm_monitor_handles_lock); -#endif - initialized = 1; -#ifndef __SINGLE_THREAD__ - __lock_release_recursive (__arm_monitor_handles_lock); + if (initialized) + { + __lock_release_recursive (__arm_monitor_handles_lock); + return; + } #endif #ifdef ARM_RDI_MONITOR @@ -156,6 +157,11 @@ initialise_monitor_handles (void) openfiles[0].pos = 0; openfiles[1].handle = monitor_stdout; openfiles[1].pos = 0; + + initialized = 1; +#ifndef __SINGLE_THREAD__ + __lock_release_recursive (__arm_monitor_handles_lock); +#endif } static int |