tidy up autoconfiguration of docbook stuff
[ghc-hetmet.git] / rts / Threads.c
index 936b90e..0bc725c 100644 (file)
@@ -84,9 +84,10 @@ createThread(Capability *cap, nat size)
        size = MIN_STACK_WORDS + TSO_STRUCT_SIZEW;
     }
 
-    stack_size = size - TSO_STRUCT_SIZEW;
-    
+    size = round_to_mblocks(size);
     tso = (StgTSO *)allocateLocal(cap, size);
+
+    stack_size = size - TSO_STRUCT_SIZEW;
     TICK_ALLOC_TSO(stack_size, 0);
 
     SET_HDR(tso, &stg_TSO_info, CCS_SYSTEM);
@@ -210,6 +211,8 @@ createThread(Capability *cap, nat size)
     }
 #endif 
     
+    postEvent (cap, EVENT_CREATE_THREAD, tso->id, 0);
+
 #if defined(GRAN)
     debugTrace(GRAN_DEBUG_pri,
               "==__ schedule: Created TSO %d (%p);",
@@ -503,6 +506,7 @@ unblockOne_ (Capability *cap, StgTSO *tso,
          ASSERT(tso->bound->cap == tso->cap);
          tso->bound->cap = cap;
       }
+
       tso->cap = cap;
       appendToRunQueue(cap,tso);
 
@@ -523,8 +527,9 @@ unblockOne_ (Capability *cap, StgTSO *tso,
   cap->context_switch = 1;
 #endif
 
-  debugTrace(DEBUG_sched,
-            "waking up thread %ld on cap %d",
+  postEvent (cap, EVENT_THREAD_WAKEUP, tso->id, tso->cap->no);
+
+  debugTrace(DEBUG_sched, "waking up thread %ld on cap %d",
             (long)tso->id, tso->cap->no);
 
   return next;