OSDN Git Service

Based on work by Stefan Allius, arrange for early initialization of
authorEric Andersen <andersen@codepoet.org>
Mon, 19 Aug 2002 10:05:03 +0000 (10:05 -0000)
committerEric Andersen <andersen@codepoet.org>
Mon, 19 Aug 2002 10:05:03 +0000 (10:05 -0000)
pthread stuff.  Also, don't bother building libthread_db unless we
are debugging.
 -Erik

libpthread/Makefile
libpthread/linuxthreads/errno.c
libpthread/linuxthreads/events.c
libpthread/linuxthreads/internals.h
libpthread/linuxthreads/pthread.c

index 1bf8e8c..bdd097d 100644 (file)
@@ -30,7 +30,10 @@ LIBTHREAD_DB_SHARED_FULLNAME=libthread_db-$(MAJOR_VERSION).$(MINOR_VERSION).$(SU
 
 DIRS=
 ifeq ($(strip $(INCLUDE_THREADS)),true)
-       DIRS+=linuxthreads linuxthreads_db
+       DIRS+=linuxthreads
+endif
+ifeq ($(strip $(DODEBUG)),true)
+       DIRS+=linuxthreads_db
 endif
 
 ALL_SUBDIRS = linuxthreads linuxthreads_db
index 46e2fbb..9f651b8 100644 (file)
 #include "pthread.h"
 #include "internals.h"
 #include <stdio.h>
-extern int _errno;
-extern int _h_errno;
 
 int * __errno_location()
 {
-  /* check, if the library is initilize */
-  if (__pthread_initial_thread_bos != NULL)
-  {
     pthread_descr self = thread_self();
     return THREAD_GETMEM (self, p_errnop);
-  }
-  return &_errno;
 }
 
 int * __h_errno_location()
 {
-  /* check, if the library is initilize */
-  if (__pthread_initial_thread_bos != NULL)
-  {
     pthread_descr self = thread_self();
-
     return THREAD_GETMEM (self, p_h_errnop);
-  }
-  return &_h_errno;        
 }
index e5be3d9..a4bf1f8 100644 (file)
@@ -19,6 +19,8 @@
 
 /* The functions contained here do nothing, they just return.  */
 
+#include "internals.h"
+
 void
 __linuxthreads_create_event (void)
 {
index 933ccb5..ffa52af 100644 (file)
@@ -426,6 +426,7 @@ void __pthread_reset_main_thread(void);
 void __fresetlockfiles(void);
 void __pthread_manager_adjust_prio(int thread_prio);
 void __pthread_set_own_extricate_if(pthread_descr self, pthread_extricate_if *peif);
+void __pthread_initialize_minimal (void);
 
 extern int __pthread_attr_setguardsize __P ((pthread_attr_t *__attr,
                                             size_t __guardsize));
index 548f83a..5142d4c 100644 (file)
@@ -236,6 +236,18 @@ void (*__pthread_suspend)(pthread_descr) = __pthread_suspend_old;
 
 static void pthread_initialize(void) __attribute__((constructor));
 
+ /* Do some minimal initialization which has to be done during the
+    startup of the C library.  */
+void __pthread_initialize_minimal(void)
+{
+    /* If we have special thread_self processing, initialize 
+     * that for the main thread now.  */
+#ifdef INIT_THREAD_SELF
+    INIT_THREAD_SELF(&__pthread_initial_thread, 0);
+#endif
+}
+
+
 static void pthread_initialize(void)
 {
   struct sigaction sa;