Mutex & Thread under Linux.
Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=2643
Reported by Xavier Beaudouin, ISDnet kiwi@isdnet.net
On Linux and in some rare condition on FreeBSD, when using a lots of threads and mutex...
There seems to be an error in the way pike uses pthreads. From main() it calls init_program() which eventually calls mt_lock(&interleave_lock). This is done before the mutex is initialized (from low_th_init). The patch below moves the low_th_init call earlier so that the mutex is initialized before use.
Here is a patch for Pike 7.0.355 (that can be applied also on recent pike too) :
diff -u pike7-7.0.355-old/src/main.c pike7-7.0.355/src/main.c
--- pike7-7.0.355-old/src/main.c Wed Mar 14 06:21:58 2001
+++ pike7-7.0.355/src/main.c Sun Dec 16 21:04:41 2001
@@ -481,6 +481,8 @@
GETTIMEOFDAY(¤t_time);
+ low_th_init();
+
init_shared_string_table();
init_interpreter();
init_types();
@@ -488,8 +490,6 @@
init_lex();
init_program();
init_object();
-
- low_th_init();
init_modules();
master();
The patch is from Randolph Chung tausq@debian.org
You can see this in action, when setuping a Threaded caudium + camas using external auth module (ldap is an example).