2000-03-19 Ulrich Drepper <drepper@redhat.com>
+ * include/stdlib.h: Add prototype for __cxa_atexit.
+
* sysdeps/unix/sysv/linux/i386/sys/debugreg.h: Update comment about
_SLOWDOWN flags. Patch by Jim Blandy <jimb@cygnus.com>.
extern void _quicksort (void *const pbase, size_t total_elems,
size_t size, __compar_fn_t cmp);
+extern int __cxa_atexit (void (*func) (void *), void *arg, void *d);
+
#endif
#undef __Need_M_And_C
+2000-03-19 Ulrich Drepper <drepper@redhat.com>
+
+ * pthread.c (pthread_initialize): Instead of on_exit use
+ __cxa_atexit if __dso_label is available to allow unloading the
+ libpthread shared library.
+
2000-03-16 Ulrich Drepper <drepper@redhat.com>
* condvar.c: Make tests for ownership of mutex less strict.
static void pthread_initialize(void) __attribute__((constructor));
+extern void *__dso_handle __attribute__ ((weak));
+
static void pthread_initialize(void)
{
struct sigaction sa;
/* Register an exit function to kill all other threads. */
/* Do it early so that user-registered atexit functions are called
before pthread_exit_process. */
- __on_exit(pthread_exit_process, NULL);
+ if (__dso_handle)
+ /* The cast is a bit unclean. The function expects two arguments but
+ we can only pass one. Fortunately this is not a problem since the
+ second argument of `pthread_exit_process' is simply ignored. */
+ __cxa_atexit((void (*) (void *)) pthread_exit_process, NULL, __dso_handle);
+ else
+ on_exit (pthread_exit_process, NULL);
}
void __pthread_initialize(void)