diff options
author | Marco S Hyman <marc@cvs.openbsd.org> | 2003-05-13 16:49:33 +0000 |
---|---|---|
committer | Marco S Hyman <marc@cvs.openbsd.org> | 2003-05-13 16:49:33 +0000 |
commit | 09633e9f98f50e906a012742b2b61b29ecdd406c (patch) | |
tree | 3dd0d8798f873c9bd2088b18c73c04fa48a2be31 /lib/libpthread/uthread/uthread_init.c | |
parent | 936f1e7e34e563b3e201da211745dcc817c0f3b8 (diff) |
Add support for blocking thread switches during dlopen and other
non-thread-safe dl functions. Only enabled for ELF architectures
at this time as needed dlxxx support has not yet been added to the
a.out run time loader.
'doesn't break xmms at least' tedu@. Tested by others with no comment
Diffstat (limited to 'lib/libpthread/uthread/uthread_init.c')
-rw-r--r-- | lib/libpthread/uthread/uthread_init.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/libpthread/uthread/uthread_init.c b/lib/libpthread/uthread/uthread_init.c index 1be9ce7ca3a..a226a09b912 100644 --- a/lib/libpthread/uthread/uthread_init.c +++ b/lib/libpthread/uthread/uthread_init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_init.c,v 1.28 2003/02/04 22:14:27 marc Exp $ */ +/* $OpenBSD: uthread_init.c,v 1.29 2003/05/13 16:49:32 marc Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> * All rights reserved. @@ -50,6 +50,7 @@ #include <sys/user.h> #include <sys/wait.h> +#include <dlfcn.h> #include <dirent.h> #include <errno.h> #include <fcntl.h> @@ -361,7 +362,12 @@ _thread_init(void) /* Initialise the garbage collector mutex and condition variable. */ if (pthread_mutex_init(&_gc_mutex,NULL) != 0 || pthread_cond_init(&_gc_cond,NULL) != 0) - PANIC("Failed to initialise garbage collector mutex or condvar"); + PANIC("Failed to initialise garbage collector mutex or cond"); + +#if defined(__ELF__) + /* Register with dlctl for thread safe dlopen */ + dlctl(NULL, DL_SETTHREADLCK, _thread_kern_lock); +#endif _thread_autoinit_dummy_decl = 0; } #endif |