[uClibc-cvs] uClibc/libpthread/linuxthreads lockfile.c, 1.3, 1.4 pthread.c, 1.12, 1.13

Manuel Novoa III mjn3 at uclibc.org
Wed Feb 11 23:48:55 UTC 2004


Update of /var/cvs/uClibc/libpthread/linuxthreads
In directory nail:/tmp/cvs-serv16121/libpthread/linuxthreads

Modified Files:
	lockfile.c pthread.c 
Log Message:
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.


Index: pthread.c
===================================================================
RCS file: /var/cvs/uClibc/libpthread/linuxthreads/pthread.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- pthread.c	16 Jan 2004 13:43:27 -0000	1.12
+++ pthread.c	11 Feb 2004 23:48:50 -0000	1.13
@@ -101,7 +101,7 @@
   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 @@
   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 @@
   __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). */

Index: lockfile.c
===================================================================
RCS file: /var/cvs/uClibc/libpthread/linuxthreads/lockfile.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- lockfile.c	27 Dec 2003 23:30:50 -0000	1.3
+++ lockfile.c	11 Feb 2004 23:48:50 -0000	1.4
@@ -20,29 +20,8 @@
 #include <stdio.h>
 #include <pthread.h>
 
-void
-__flockfile (FILE *stream)
-{
-  pthread_mutex_lock(&stream->lock);
-}
-weak_alias (__flockfile, flockfile);
-
-
-void
-__funlockfile (FILE *stream)
-{
-  pthread_mutex_unlock(&stream->lock);
-}
-weak_alias (__funlockfile, funlockfile);
-
-
-int
-__ftrylockfile (FILE *stream)
-{
-  return pthread_mutex_trylock(&stream->lock);
-}
-weak_alias (__ftrylockfile, ftrylockfile);
-
+/* Note: glibc puts flockfile, funlockfile, and ftrylockfile in both
+ * libc and libpthread.  In uClibc, they are now in libc only.  */
 
 void
 __fresetlockfiles (void)
@@ -53,8 +32,8 @@
   pthread_mutexattr_init(&attr);
   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
 
-  for (fp = _stdio_openlist; fp != NULL; fp = fp->nextopen)
-    pthread_mutex_init(&fp->lock, &attr);
+  for (fp = _stdio_openlist; fp != NULL; fp = fp->__nextopen)
+    pthread_mutex_init(&fp->__lock, &attr);
 
   pthread_mutexattr_destroy(&attr);
 }




More information about the uClibc-cvs mailing list