diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | linuxthreads/ChangeLog | 12 | ||||
-rw-r--r-- | linuxthreads/pthread.c | 23 | ||||
-rw-r--r-- | linuxthreads/restart.h | 24 |
4 files changed, 54 insertions, 10 deletions
@@ -1,6 +1,9 @@ 2000-04-15 Ulrich Drepper <drepper@redhat.com> - * sysdeps/alpha/dl-machine.h (RTLD_START):Rewrite for new init + * sysdeps/unix/sysv/linux/alpha/adjtime.c: Fix typo in + compat_symbol call for old adjtime. + + * sysdeps/alpha/dl-machine.h (RTLD_START): Rewrite for new init function interface. Patch by Richard Henderson <rth@cygnus.com>. * posix/Makefile (headers): Add spawn.h. diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index 9732297..0530c63 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,5 +1,17 @@ 2000-04-15 Ulrich Drepper <drepper@redhat.com> + * pthread.c: Is __ASSUME_REALTIME_SIGNALS then avoid generating code + to dynamically detect RT signals and avoid generating compatibility + functions with old kernel. + * restart.h (restart) [__ASSUME_REALTIME_SIGNALS]: Use + __pthread_restart_new directly. + (suspend) [__ASSUME_REALTIME_SIGNALS]: Use + __pthread_wait_for_restart_signal directly. + (timedsuspend) [__ASSUME_REALTIME_SIGNALS]: Use + __pthread_timedsuspend_new directly. + +2000-04-15 Ulrich Drepper <drepper@redhat.com> + * condvar.c: Remove all the special code to handle cond_timedwait. Use timedsuspend instead. * internals.h: Declare __pthread_timedsuspend_old, diff --git a/linuxthreads/pthread.c b/linuxthreads/pthread.c index e8ec26d..3ceb335 100644 --- a/linuxthreads/pthread.c +++ b/linuxthreads/pthread.c @@ -32,6 +32,11 @@ #include "spinlock.h" #include "restart.h" +/* Sanity check. */ +#if __ASSUME_REALTIME_SIGNALS && !defined __SIGRTMIN +# error "This must not happen; new kernel assumed but old headers" +#endif + /* Descriptor of the initial thread */ struct _pthread_descr_struct __pthread_initial_thread = { @@ -161,12 +166,14 @@ char *__pthread_manager_thread_tos = NULL; int __pthread_exit_requested = 0; int __pthread_exit_code = 0; +#if !__ASSUME_REALTIME_SIGNALS /* Pointers that select new or old suspend/resume functions based on availability of rt signals. */ void (*__pthread_restart)(pthread_descr) = __pthread_restart_old; void (*__pthread_suspend)(pthread_descr) = __pthread_suspend_old; int (*__pthread_timedsuspend)(pthread_descr, const struct timespec *) = __pthread_timedsuspend_old; +#endif /* __ASSUME_REALTIME_SIGNALS */ /* Communicate relevant LinuxThreads constants to gdb */ @@ -230,23 +237,27 @@ static int rtsigs_initialized; static void init_rtsigs (void) { +#if !__ASSUME_REALTIME_SIGNALS if (!kernel_has_rtsig ()) { current_rtmin = -1; current_rtmax = -1; -#if __SIGRTMAX - __SIGRTMIN >= 3 +# if __SIGRTMAX - __SIGRTMIN >= 3 __pthread_sig_restart = SIGUSR1; __pthread_sig_cancel = SIGUSR2; __pthread_sig_debug = 0; -#endif +# endif } else +#endif /* __ASSUME_REALTIME_SIGNALS */ { #if __SIGRTMAX - __SIGRTMIN >= 3 current_rtmin = __SIGRTMIN + 3; +# if !__ASSUME_REALTIME_SIGNALS __pthread_restart = __pthread_restart_new; __pthread_suspend = __pthread_wait_for_restart_signal; __pthread_timedsuspend = __pthread_timedsuspend_new; +# endif /* __ASSUME_REALTIME_SIGNALS */ #else current_rtmin = __SIGRTMIN; #endif @@ -825,6 +836,7 @@ void __pthread_wait_for_restart_signal(pthread_descr self) } while (self->p_signal !=__pthread_sig_restart ); } +#if !__ASSUME_REALTIME_SIGNALS /* The _old variants are for 2.0 and early 2.1 kernels which don't have RT signals. On these kernels, we use SIGUSR1 and SIGUSR2 for restart and cancellation. @@ -844,7 +856,7 @@ void __pthread_suspend_old(pthread_descr self) __pthread_wait_for_restart_signal(self); } -int +int __pthread_timedsuspend_old(pthread_descr self, const struct timespec *abstime) { sigset_t unblock, initial_mask; @@ -903,7 +915,7 @@ __pthread_timedsuspend_old(pthread_descr self, const struct timespec *abstime) Otherwise, no restart was delivered yet, so a potential race exists; we return a 0 to the caller which must deal with this race in an appropriate way; for example by - atomically removing the thread from consideration for a + atomically removing the thread from consideration for a wakeup---if such a thing fails, it means a restart is being delivered. */ @@ -920,6 +932,7 @@ __pthread_timedsuspend_old(pthread_descr self, const struct timespec *abstime) /* woken due to restart signal */ return 1; } +#endif /* __ASSUME_REALTIME_SIGNALS */ void __pthread_restart_new(pthread_descr th) { @@ -929,7 +942,7 @@ void __pthread_restart_new(pthread_descr th) /* There is no __pthread_suspend_new because it would just be a wasteful wrapper for __pthread_wait_for_restart_signal */ -int +int __pthread_timedsuspend_new(pthread_descr self, const struct timespec *abstime) { sigset_t unblock, initial_mask; diff --git a/linuxthreads/restart.h b/linuxthreads/restart.h index 0a69309..24d9fab 100644 --- a/linuxthreads/restart.h +++ b/linuxthreads/restart.h @@ -13,21 +13,37 @@ /* GNU Library General Public License for more details. */ #include <signal.h> +#include <kernel-features.h> /* Primitives for controlling thread execution */ static inline void restart(pthread_descr th) { - __pthread_restart(th); /* see pthread.c */ + /* See pthread.c */ +#if __ASSUME_REALTIME_SIGNALS + __pthread_restart_new(th); +#else + __pthread_restart(th); +#endif } static inline void suspend(pthread_descr self) { - __pthread_suspend(self); /* see pthread.c */ + /* See pthread.c */ +#if __ASSUME_REALTIME_SIGNALS + __pthread_wait_for_restart_signal(self); +#else + __pthread_suspend(self); +#endif } -static inline int timedsuspend(pthread_descr self, +static inline int timedsuspend(pthread_descr self, const struct timespec *abstime) { - return __pthread_timedsuspend(self, abstime); /* see pthread.c */ + /* See pthread.c */ +#if __ASSUME_REALTIME_SIGNALS + return __pthread_timedsuspend_new(self, abstime); +#else + return __pthread_timedsuspend(self, abstime); +#endif } |