New thread.c from Sjoerd, supports _exit_prog().  Use this in goaway()
to avoid hanging in cleanup().
diff --git a/Modules/threadmodule.c b/Modules/threadmodule.c
index 6ab7ea8..c2d67fc 100644
--- a/Modules/threadmodule.c
+++ b/Modules/threadmodule.c
@@ -31,6 +31,8 @@
 
 #include "thread.h"
 
+int threads_started = 0;
+
 object *ThreadError;
 
 
@@ -177,6 +179,8 @@
 	object *args = (object *) args_raw;
 	object *func, *arg, *res;
 
+	threads_started++;
+
 	restore_thread((void *)NULL);
 	func = gettupleitem(args, 0);
 	arg = gettupleitem(args, 1);
@@ -230,7 +234,7 @@
 	int sts;
 	if (!getargs(args, "i", &sts))
 		return NULL;
-	goaway(sts);
+	goaway(sts); /* Calls exit_prog(sts) or _exit_prog(sts) */
 	for (;;) { } /* Should not be reached */
 }