b9dc31ad0b
Based on patch provided by Raphael Langerhorst in PR 35308. 1.0pre3: - Many tiny code cleanups and some small fixes - Some fixes for *BSD systems and 64bit sysytems - List of builtin functions is now a hash (thx to bernd) - Improved performance by reusing stack structs (thx to bernd) 1.0pre2: It contains some small cleanups and build fixes related to mod_fann and mod_gl. 1.0pre1: It only contains some small bugfixes and cleanups compared to version 0.9i 0.9i: This release is primarly a bugfix release.
46 lines
1.1 KiB
Text
46 lines
1.1 KiB
Text
$NetBSD: patch-aa,v 1.2 2007/03/17 08:45:04 obache Exp $
|
|
|
|
--- clib.c.orig 2006-11-14 13:54:32.000000000 +0000
|
|
+++ clib.c
|
|
@@ -402,13 +402,40 @@ static inline void DO_UNLOCK() {
|
|
|
|
# else
|
|
|
|
-static pthread_mutex_t load_unload_lck = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
|
|
+static int load_unload_initialised;
|
|
+static pthread_mutex_t load_unload_init_lck = PTHREAD_MUTEX_INITIALIZER;
|
|
+static pthread_mutex_t load_unload_lck;
|
|
+
|
|
+static void DO_LOCK_INIT(void)
|
|
+{
|
|
+ pthread_mutexattr_t mattr;
|
|
+
|
|
+ pthread_mutex_lock(&load_unload_init_lck);
|
|
+
|
|
+ if (load_unload_initialised) {
|
|
+ pthread_mutex_unlock(&load_unload_init_lck);
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ pthread_mutexattr_init(&mattr);
|
|
+ pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
|
|
+ pthread_mutex_init(&load_unload_lck, &mattr);
|
|
+ pthread_mutexattr_destroy(&mattr);
|
|
+
|
|
+ load_unload_initialised = 1;
|
|
+
|
|
+ pthread_mutex_unlock(&load_unload_init_lck);
|
|
+}
|
|
|
|
static inline void DO_LOCK() {
|
|
+ if (!load_unload_initialised)
|
|
+ DO_LOCK_INIT();
|
|
pthread_mutex_lock(&load_unload_lck);
|
|
}
|
|
|
|
static inline void DO_UNLOCK() {
|
|
+ if (!load_unload_initialised)
|
|
+ DO_LOCK_INIT();
|
|
pthread_mutex_unlock(&load_unload_lck);
|
|
}
|
|
|