move usleep(1) to gc_thread_work() from any_work()
[ghc-hetmet.git] / rts / sm / GC.c
index 5b16694..fa58905 100644 (file)
@@ -11,7 +11,7 @@
  *
  * ---------------------------------------------------------------------------*/
 
-#include "PosixSource.h"
+// #include "PosixSource.h"
 #include "Rts.h"
 #include "RtsFlags.h"
 #include "RtsUtils.h"
@@ -51,6 +51,7 @@
 #include "Sparks.h"
 
 #include <string.h> // for memset()
+#include <unistd.h>
 
 /* -----------------------------------------------------------------------------
    Global variables
@@ -1057,6 +1058,7 @@ loop:
               gct->thread_index, r);
 
     while (gc_running_threads != 0) {
+        usleep(1);
        if (any_work()) {
            inc_running();
            goto loop;
@@ -1197,6 +1199,7 @@ init_collected_gen (nat g, nat n_threads)
 
        // we don't have any to-be-scavenged blocks yet
        stp->todos = NULL;
+        stp->todos_last = NULL;
        stp->n_todos = 0;
 
        // initialise the large object queues.