This is the mail archive of the libc-hacker@cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

A new pthread patch


Hi,

I don't like to call __libc_allocate_rtsig () for thread signals. It
is very unreliable for gdb. Here is my patch for linuxthreads. It moves
thread signals to glibc, which will be initialized at the link time. I
will send you a patch for glibc in another email.

Thanks.

-- 
H.J. Lu (hjl@gnu.org)
--
Sun Feb  7 19:27:06 1999  H.J. Lu  <hjl@gnu.org>

	* Versions: Add __pthread_threads_debug to GLIBC_2.1 for
	libpthread.

	* internals.h (DEFAULT_SIG_RESTART): Removed.
	(DEFAULT_SIG_CANCEL): Removed.

	* pthread.c (__pthread_sig_restart): Make it extern.
	(__pthread_sig_cancel): Likewise.
	(__pthread_sig_debug): Likewise.
	(pthread_initialize): Call __libc_init_rtsigs () initialize
	real-time signals.

Index: Versions
===================================================================
RCS file: /home/work/cvs/gnu/glibc/linuxthreads/Versions,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 Versions
--- Versions	1998/07/27 22:27:11	1.1.1.2
+++ Versions	1999/02/08 03:24:24
@@ -93,5 +93,8 @@ libpthread {
     pthread_getconcurrency; pthread_setconcurrency;
 
     pthread_mutexattr_gettype; pthread_mutexattr_settype;
+
+    # New ones.
+    __pthread_threads_debug;
   }
 }
Index: internals.h
===================================================================
RCS file: /home/work/cvs/gnu/glibc/linuxthreads/internals.h,v
retrieving revision 1.1.1.10
diff -u -p -r1.1.1.10 internals.h
--- internals.h	1999/01/09 18:18:04	1.1.1.10
+++ internals.h	1999/02/08 01:05:18
@@ -152,11 +152,6 @@ extern int __pthread_sig_cancel;
 
 extern int __pthread_sig_debug;
 
-/* Default signals used if we don't have realtime signals */
-
-#define DEFAULT_SIG_RESTART SIGUSR1
-#define DEFAULT_SIG_CANCEL SIGUSR2
-
 /* Global array of thread handles, used for validating a thread id
    and retrieving the corresponding thread descriptor. Also used for
    mapping the available stack segments. */
Index: pthread.c
===================================================================
RCS file: /home/work/cvs/gnu/glibc/linuxthreads/pthread.c,v
retrieving revision 1.1.1.12
diff -u -p -r1.1.1.12 pthread.c
--- pthread.c	1999/02/07 17:09:08	1.1.1.12
+++ pthread.c	1999/02/08 02:06:59
@@ -147,15 +147,9 @@ const int __pthread_offsetof_pid = offse
                                             p_pid);
 
 /* Signal numbers used for the communication.  */
-#ifdef SIGRTMIN
-int __pthread_sig_restart;
-int __pthread_sig_cancel;
-int __pthread_sig_debug;
-#else
-int __pthread_sig_restart = DEFAULT_SIG_RESTART;
-int __pthread_sig_cancel = DEFAULT_SIG_CANCEL;
-int __pthread_sig_debug = 0;    /* disabled */
-#endif
+extern int __pthread_sig_restart;
+extern int __pthread_sig_cancel;
+extern int __pthread_sig_debug;
 
 /* These variables are used by the setup code.  */
 extern int _errno;
@@ -219,22 +213,9 @@ static void pthread_initialize(void)
   /* The errno/h_errno variable of the main thread are the global ones.  */
   __pthread_initial_thread.p_errnop = &_errno;
   __pthread_initial_thread.p_h_errnop = &_h_errno;
-#ifdef SIGRTMIN
-  /* Allocate the signals used.  */
-  __pthread_sig_restart = __libc_allocate_rtsig (1);
-  __pthread_sig_cancel = __libc_allocate_rtsig (1);
-  __pthread_sig_debug = __libc_allocate_rtsig (1);
-  if (__pthread_sig_restart < 0 ||
-      __pthread_sig_cancel < 0 ||
-      __pthread_sig_debug < 0)
-    {
-      /* The kernel does not support real-time signals.  Use as before
-	 the available signals in the fixed set.
-         Debugging is not supported in this case. */
-      __pthread_sig_restart = DEFAULT_SIG_RESTART;
-      __pthread_sig_cancel = DEFAULT_SIG_CANCEL;
-      __pthread_sig_debug = 0;
-    }
+#ifdef __SIGRTMIN
+  /* Initialize real-time signals. */
+  __libc_init_rtsigs ();
 #endif
   /* Setup signal handlers for the initial thread.
      Since signal handlers are shared between threads, these settings


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]