--- std/thread.d.old	2008-01-11 19:11:03.000000000 +0100
+++ std/thread.d	2008-01-12 09:36:15.000000000 +0100
@@ -572,7 +572,7 @@
 
     pthread_t id;
     void* stackBottom;
-    void* stackTop;
+    void* lastESP;
 
     void start()
     {
@@ -1115,6 +1115,18 @@
 	}
     }
 
+    public void* stacktop_override;
+    public void* stackTop()
+    {
+	if (stacktop_override)
+	    return stacktop_override;
+	return lastESP;
+    }
+    public void* stackTop(void* v)
+    {
+	lastESP=v;
+	return v;
+    }
     public static void* getESP()
     {
 	// TODO add builtin for using stack_pointer_rtx
--- std/gc.d	2007-10-16 21:02:09.000000000 +0200
+++ ../../../gcc-4.1.2/gcc/d/phobos/std/gc.d	2008-01-12 09:21:27.000000000 +0100
@@ -191,3 +191,5 @@
     void gc_init();
     void gc_term();
 }
+
+void delegate() preCollectDg, postCollectDg;
--- internal/gc/gcx.d	2007-10-16 21:02:17.000000000 +0200
+++ ../../../gcc-4.1.2/gcc/d/phobos/internal/gc/gcx.d	2008-01-12 09:20:31.000000000 +0100
@@ -1602,6 +1602,9 @@
 	debug(COLLECT_PRINTF) printf("Gcx.fullcollect()\n");
 
 	Thread.pauseAll();
+	
+	if (preCollectDg) preCollectDg();
+	scope(exit) if (postCollectDg) postCollectDg();
 
 	p_cache = null;
 	size_cache = 0;
