diff --git a/src/malloc.c b/src/malloc.c
index 74aadf170d90d6dee45bd52b28cad0bf3e12669a..0d585d5cf71741e620d63bafdc2cdb68546727ed 100644
--- a/src/malloc.c
+++ b/src/malloc.c
@@ -2,7 +2,9 @@
 /* This is only used when --enable-dlmalloc is specified (default on
  * Windows). */
 #include "global.h"
+#ifdef PIKE_THREADS
 #define USE_LOCKS 1
+#endif
 #define USE_DL_PREFIX 1
 /* Further pike changes below: PMOD_EXPORTs and lines marked "PIKE". */
 /* End pike preamble */