diff --git a/src/modules/Gdbm/gdbmmod.c b/src/modules/Gdbm/gdbmmod.c
index 490286136b65fd866adad169ae7a223b5f95ca05..bfccd2e7dfe22fc285b78334a5c39f16e918d78a 100644
--- a/src/modules/Gdbm/gdbmmod.c
+++ b/src/modules/Gdbm/gdbmmod.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: gdbmmod.c,v 1.8 1999/06/19 20:20:38 hubbe Exp $");
+RCSID("$Id: gdbmmod.c,v 1.9 2000/04/18 06:53:53 jonasw Exp $");
 #include "gdbm_machine.h"
 #include "threads.h"
 
@@ -22,7 +22,7 @@ RCSID("$Id: gdbmmod.c,v 1.8 1999/06/19 20:20:38 hubbe Exp $");
 #include <gdbm.h>
 
 #ifdef _REENTRANT
-static MUTEX_T gdbm_lock;
+static MUTEX_T gdbm_lock STATIC_MUTEX_INIT;
 #endif  
 
 struct gdbm_glue
diff --git a/src/modules/HTTPLoop/accept_and_parse.c b/src/modules/HTTPLoop/accept_and_parse.c
index 50e65901ab35e065f890702c020db82f078daa5c..04a9968088bfdcfc778ab4829a37b684fd52228b 100644
--- a/src/modules/HTTPLoop/accept_and_parse.c
+++ b/src/modules/HTTPLoop/accept_and_parse.c
@@ -70,10 +70,10 @@ struct program *accept_loop_program;
 #endif
 
 #define MAXLEN (1024*1024*10)
-static MUTEX_T queue_mutex;
+static MUTEX_T queue_mutex STATIC_MUTEX_INIT;
 static struct args *request, *last;
 
-static MUTEX_T arg_lock;
+static MUTEX_T arg_lock STATIC_MUTEX_INIT;
 static int next_free_arg, num_args;
 static struct args *free_arg_list[100];
 
@@ -584,14 +584,16 @@ static void f_accept_with_http_parse(INT32 nargs)
   {
     struct log *log = aap_malloc(sizeof(struct log));
     MEMSET(log, 0, sizeof(struct log));
+    mt_init(&log->log_lock);
     args->log = log;
     log->next = aap_first_log;
     aap_first_log = log;
   }
   c = aap_malloc(sizeof(struct cache));
+  MEMSET(c, 0, sizeof(struct cache));
+  mt_init(&c->mutex);
   c->next = first_cache;
   first_cache = c;
-  MEMSET(c, 0, sizeof(struct cache));
   args->cache = c;
   c->max_size = ms;
   args->fd = ((struct port *)port->storage)->fd;
diff --git a/src/modules/HTTPLoop/cache.c b/src/modules/HTTPLoop/cache.c
index 9225dd674854d281ce7ec8f7b7bef368a2b1424b..5af3cc8b4efee9dea157a99aca20019357c8bbab 100644
--- a/src/modules/HTTPLoop/cache.c
+++ b/src/modules/HTTPLoop/cache.c
@@ -30,9 +30,9 @@ struct cache *first_cache;
 
 static struct pike_string *free_queue[1024];
 static int numtofree;
-static MUTEX_T tofree_mutex;
+static MUTEX_T tofree_mutex STATIC_MUTEX_INIT;
 
-static MUTEX_T cache_entry_lock;
+static MUTEX_T cache_entry_lock STATIC_MUTEX_INIT;
 int next_free_ce, num_cache_entries;
 struct cache_entry *free_cache_entries[1024];
 
diff --git a/src/modules/Msql/msqlmod.c b/src/modules/Msql/msqlmod.c
index 739d39a4dc16739e3bda08db8c59b5cd2a172212..c3e7ef726ee3848eac6eba46db74ee4382e17686 100644
--- a/src/modules/Msql/msqlmod.c
+++ b/src/modules/Msql/msqlmod.c
@@ -2,7 +2,7 @@
  * This code is (C) Francesco Chemolli, 1997.
  * You may use, modify and redistribute it freely under the terms
  * of the GNU General Public License, version 2.
- * $Id: msqlmod.c,v 1.11 2000/04/13 18:37:16 grubba Exp $
+ * $Id: msqlmod.c,v 1.12 2000/04/18 06:54:05 jonasw Exp $
  *
  * This version is intended for Pike/0.5 and later.
  * It won't compile under older versions of the Pike interpreter.
@@ -35,11 +35,11 @@
 #include "operators.h"
 #include "multiset.h"
 
-RCSID("$Id: msqlmod.c,v 1.11 2000/04/13 18:37:16 grubba Exp $");
+RCSID("$Id: msqlmod.c,v 1.12 2000/04/18 06:54:05 jonasw Exp $");
 #include "version.h"
 
 #ifdef _REENTRANT
-MUTEX_T pike_msql_mutex;
+MUTEX_T pike_msql_mutex STATIC_MUTEX_INIT;
 #define MSQL_LOCK() mt_lock(&pike_msql_mutex)
 #define MSQL_UNLOCK() mt_unlock(&pike_msql_mutex)
 #else
diff --git a/src/modules/Postgres/pgresult.c b/src/modules/Postgres/pgresult.c
index ad3969d9fb271a1ab344e79d61d838e89b1f9bd5..3b66d122c181533604a6e2dd55bc21aad32142b4 100644
--- a/src/modules/Postgres/pgresult.c
+++ b/src/modules/Postgres/pgresult.c
@@ -1,5 +1,5 @@
 /*
- * $Id: pgresult.c,v 1.11 1999/04/30 07:22:52 hubbe Exp $
+ * $Id: pgresult.c,v 1.12 2000/04/18 06:54:08 jonasw Exp $
  *
  * Postgres95 support for pike/0.5 and up
  *
@@ -63,10 +63,10 @@
 #include "builtin_functions.h"
 #include "module_support.h"
 
-RCSID("$Id: pgresult.c,v 1.11 1999/04/30 07:22:52 hubbe Exp $");
+RCSID("$Id: pgresult.c,v 1.12 2000/04/18 06:54:08 jonasw Exp $");
 
 #ifdef _REENTRANT
-MUTEX_T pike_postgres_result_mutex;
+MUTEX_T pike_postgres_result_mutex STATIC_MUTEX_INIT;
 #define PQ_LOCK() mt_lock(&pike_postgres_mutex)
 #define PQ_UNLOCK() mt_unlock(&pike_postgres_mutex)
 #else
diff --git a/src/modules/Postgres/postgres.c b/src/modules/Postgres/postgres.c
index 0fd5b1800478751e133ba0604e181c88e00fe151..a8f5deeb206eb1c472b74b69f024031aa105c771 100644
--- a/src/modules/Postgres/postgres.c
+++ b/src/modules/Postgres/postgres.c
@@ -38,7 +38,7 @@
 
 /* Actual code */
 #ifdef _REENTRANT
-MUTEX_T pike_postgres_mutex;
+MUTEX_T pike_postgres_mutex STATIC_MUTEX_INIT;
 #define PQ_LOCK() mt_lock(&pike_postgres_mutex);
 #define PQ_UNLOCK() mt_unlock(&pike_postgres_mutex);
 #else
@@ -56,7 +56,7 @@ static void pgdebug (char * a, ...) {}
 
 struct program * postgres_program;
 
-RCSID("$Id: postgres.c,v 1.16 2000/04/04 14:18:51 grubba Exp $");
+RCSID("$Id: postgres.c,v 1.17 2000/04/18 06:54:08 jonasw Exp $");
 
 #define THIS ((struct pgres_object_data *) fp->current_storage)
 
diff --git a/src/modules/spider/spider.c b/src/modules/spider/spider.c
index b6a0b444843d09b0b6e966883525bdb70413ce5b..c71080326bfa1bb9d92ab355502c46b9d14a8d36 100644
--- a/src/modules/spider/spider.c
+++ b/src/modules/spider/spider.c
@@ -43,7 +43,7 @@
 #include "threads.h"
 #include "operators.h"
 
-RCSID("$Id: spider.c,v 1.89 2000/02/16 04:00:18 per Exp $");
+RCSID("$Id: spider.c,v 1.90 2000/04/18 06:54:13 jonasw Exp $");
 
 #ifdef HAVE_PWD_H
 #include <pwd.h>
@@ -1146,7 +1146,7 @@ struct thread_args
   char buffer[BUFFER];
 };
 
-MUTEX_T done_lock;
+MUTEX_T done_lock STATIC_MUTEX_INIT;
 struct thread_args *done;
 
 /* WARNING! This function is running _without_ any stack etc. */
diff --git a/src/threads.c b/src/threads.c
index 23d3b57ad61dfc067e0d864302e6fea892ca835c..ab0a7bb58a293ff5e21d64fcf01f51f8a9914e11 100644
--- a/src/threads.c
+++ b/src/threads.c
@@ -1,5 +1,5 @@
 #include "global.h"
-RCSID("$Id: threads.c,v 1.119 2000/04/15 05:05:28 hubbe Exp $");
+RCSID("$Id: threads.c,v 1.120 2000/04/18 06:53:48 jonasw Exp $");
 
 int num_threads = 1;
 int threads_disabled = 0;
@@ -1359,7 +1359,7 @@ static struct farmer {
   COND_T harvest_moon;
 } *farmers;
 
-static MUTEX_T rosie;
+static MUTEX_T rosie STATIC_MUTEX_INIT;
 
 static TH_RETURN_TYPE farm(void *_a)
 {
diff --git a/src/threads.h b/src/threads.h
index 0fb6dcb4b525d0e50dbcf0b578a99c21a2d20a19..d77e97e9ce4f033198b8d752d3870ba5d9f5277d 100644
--- a/src/threads.h
+++ b/src/threads.h
@@ -1,5 +1,5 @@
 /*
- * $Id: threads.h,v 1.83 2000/04/17 18:47:44 mast Exp $
+ * $Id: threads.h,v 1.84 2000/04/18 06:53:48 jonasw Exp $
  */
 #ifndef THREADS_H
 #define THREADS_H
@@ -656,4 +656,19 @@ extern int thread_storage_offset;
 #define MUTEX_T PIKE_MUTEX_T
 #endif
 
+
+/* Initializer macros for static mutex and condition variables */
+#ifdef PTHREAD_MUTEX_INITIALIZER
+#define STATIC_MUTEX_INIT  = PTHREAD_MUTEX_INITIALIZER
+#else
+#define STATIC_MUTEX_INIT
+#endif
+#ifdef PTHREAD_COND_INITIALIZER
+#define STATIC_COND_INIT   = PTHREAD_COND_INITIALIZER
+#else
+#define STATIC_COND_INIT
+#endif
+
+
+
 #endif /* THREADS_H */