summaryrefslogtreecommitdiff
path: root/libpthread/linuxthreads/pthread.c
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2004-02-11 23:48:50 +0000
committerManuel Novoa III <mjn3@codepoet.org>2004-02-11 23:48:50 +0000
commit082e680bd54e999f2bb4eb77141958938b1e9ee9 (patch)
tree203c45b85ca608e1550d8ffc459456fc9cf0b30b /libpthread/linuxthreads/pthread.c
parent17c21765b4a97c6f0b74ba8466073e5a3f97cdee (diff)
New stdio core. Should be more maintainable. Fixes a couple of bugs.
Codepaths streamlined. Improved performance for nonthreaded apps when linked with a thread-enabled libc. Minor iconv bug and some locale/thread related startup issues fixed. These showed up in getting a gcj-compiled java helloworld app running. Removed some old extension functions... _stdio_fdout and _stdio_fsfopen.
Diffstat (limited to 'libpthread/linuxthreads/pthread.c')
-rw-r--r--libpthread/linuxthreads/pthread.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/libpthread/linuxthreads/pthread.c b/libpthread/linuxthreads/pthread.c
index e9ca9aa32..c4225bce8 100644
--- a/libpthread/linuxthreads/pthread.c
+++ b/libpthread/linuxthreads/pthread.c
@@ -101,7 +101,7 @@ struct _pthread_descr_struct __pthread_initial_thread = {
0 /* int p_untracked_readlock_count; */
#ifdef __UCLIBC_HAS_XLOCALE__
,
- NULL, /* __locale_t locale; */
+ &__global_locale_data, /* __locale_t locale; */
#endif /* __UCLIBC_HAS_XLOCALE__ */
};
@@ -157,7 +157,7 @@ struct _pthread_descr_struct __pthread_manager_thread = {
0 /* int p_untracked_readlock_count; */
#ifdef __UCLIBC_HAS_XLOCALE__
,
- NULL, /* __locale_t locale; */
+ &__global_locale_data, /* __locale_t locale; */
#endif /* __UCLIBC_HAS_XLOCALE__ */
};
@@ -332,6 +332,17 @@ static void pthread_initialize(void)
__pthread_initial_thread.locale = __curlocale_var;
#endif /* __UCLIBC_HAS_XLOCALE__ */
+ { /* 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;
+ }
+ }
+ }
+
/* Play with the stack size limit to make sure that no stack ever grows
beyond STACK_SIZE minus two pages (one page for the thread descriptor
immediately beyond, and one page to act as a guard page). */