diff --git a/src/modules/files/file.c b/src/modules/files/file.c
index 2277ff14e2513ef04c6a51475607831a5d0af5f6..3a3f3af5aec1484f73864fb8dc2e2cb2a5d03212 100644
--- a/src/modules/files/file.c
+++ b/src/modules/files/file.c
@@ -5,7 +5,7 @@
 \*/
 
 #include "global.h"
-RCSID("$Id: file.c,v 1.134 1999/05/08 04:46:27 hubbe Exp $");
+RCSID("$Id: file.c,v 1.135 1999/05/14 22:30:56 hubbe Exp $");
 #include "fdlib.h"
 #include "interpret.h"
 #include "svalue.h"
@@ -2042,6 +2042,7 @@ static TH_RETURN_TYPE proxy_thread(void * data)
   num_threads--;
   mt_unlock(&interpreter_lock);
   free((char *)p);
+  th_exit(0);
   return 0;
 }
 
diff --git a/src/threads.h b/src/threads.h
index 38445327ad98257aca401ea5738ea4c2cd3738f3..89c3388526d27c6596b495854e0ce04ed922dfd1 100644
--- a/src/threads.h
+++ b/src/threads.h
@@ -1,5 +1,5 @@
 /*
- * $Id: threads.h,v 1.63 1999/05/12 05:27:49 hubbe Exp $
+ * $Id: threads.h,v 1.64 1999/05/14 22:30:29 hubbe Exp $
  */
 #ifndef THREADS_H
 #define THREADS_H
@@ -185,7 +185,7 @@ extern pthread_attr_t small_pattr;
 #define th_create_small(ID,fun,arg) low_nt_create_thread(8192*sizeof(char *), fun,arg,ID)
 #define TH_RETURN_TYPE unsigned __stdcall
 #define TH_STDCALL __stdcall
-#define th_exit(foo) _endthread(foo)
+#define th_exit(foo) _endthreadex(foo)
 #define th_join(ID,res)	/******************* FIXME! ****************/
 #define th_self() GetCurrentThreadId()
 #define th_destroy(X)