[git commit 0.9.31] linuxthreads.new: initialize stdio locking

Timo Teräs timo.teras at iki.fi
Wed Apr 14 17:58:30 UTC 2010


commit: http://git.uclibc.org/uClibc/commit/?id=d4ede2b0a4727c1f5236dd9308f09cbf7a39761a
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/0.9.31

uClibc requires the threading library to enable locking for
stdio, or the locking is not done at all.

Signed-off-by: Timo Teräs <timo.teras at iki.fi>
Signed-off-by: Austin Foxley <austinf at cetoncorp.com>
---
 libpthread/linuxthreads/pthread.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/libpthread/linuxthreads/pthread.c b/libpthread/linuxthreads/pthread.c
index 6ae9a10..614cad1 100644
--- a/libpthread/linuxthreads/pthread.c
+++ b/libpthread/linuxthreads/pthread.c
@@ -613,6 +613,17 @@ static void pthread_initialize(void)
 #ifdef USE_TLS
   GL(dl_init_static_tls) = &__pthread_init_static_tls;
 #endif
+
+  /* uClibc-specific stdio initialization for threads. */
+  {
+    FILE *fp;
+    _stdio_user_locking = 0;       /* 2 if threading not initialized */
+    for (fp = _stdio_openlist; fp != NULL; fp = fp->__nextopen) {
+      if (fp->__user_locking != 1) {
+        fp->__user_locking = 0;
+      }
+    }
+  }
 }
 
 void __pthread_initialize(void)
-- 
1.6.3.3



More information about the uClibc-cvs mailing list