Make allocatePinned use local storage, and other refactorings
[ghc-hetmet.git] / rts / Capability.c
index 8cfcba0..0012c24 100644 (file)
@@ -77,7 +77,7 @@ findSpark (Capability *cap)
   rtsBool retry;
   nat i = 0;
 
-  if (!emptyRunQueue(cap)) {
+  if (!emptyRunQueue(cap) || cap->returning_tasks_hd != NULL) {
       // If there are other threads, don't try to run any new
       // sparks: sparks might be speculative, we don't want to take
       // resources away from the main computation.
@@ -253,6 +253,7 @@ initCapability( Capability *cap, nat i )
     cap->free_trec_headers = NO_TREC;
     cap->transaction_tokens = 0;
     cap->context_switch = 0;
+    cap->pinned_object_block = NULL;
 }
 
 /* ---------------------------------------------------------------------------
@@ -830,6 +831,7 @@ static void
 freeCapability (Capability *cap)
 {
     stgFree(cap->mut_lists);
+    stgFree(cap->saved_mut_lists);
 #if defined(THREADED_RTS)
     freeSparkPool(cap->sparks);
 #endif