diff options
-rw-r--r-- | rts/Capability.h | 5 | ||||
-rw-r--r-- | rts/Schedule.c | 7 | ||||
-rw-r--r-- | rts/Schedule.h | 1 |
3 files changed, 10 insertions, 3 deletions
diff --git a/rts/Capability.h b/rts/Capability.h index 250ec2219c..05a827c7b9 100644 --- a/rts/Capability.h +++ b/rts/Capability.h @@ -264,7 +264,10 @@ typedef enum { // typedef struct { SyncType type; // The kind of synchronisation - bool *idle; + bool *idle; // Array of size n_capabilities. idle[i] is true + // if capability i will be idle during this GC + // cycle. Only available when doing GC (when + // type is SYNC_GC_*). Task *task; // The Task performing the sync } PendingSync; diff --git a/rts/Schedule.c b/rts/Schedule.c index 0444f0ca15..d104cfd23d 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -668,8 +668,10 @@ scheduleYield (Capability **pcap, Task *task) // otherwise yield (sleep), and keep yielding if necessary. do { if (doIdleGCWork(cap, false)) { + // there's more idle GC work to do didGcLast = false; } else { + // no more idle GC work to do didGcLast = yieldCapability(&cap,task, !didGcLast); } } @@ -1876,7 +1878,7 @@ delete_threads_and_gc: releaseGCThreads(cap, idle_cap); } #endif - if (heap_overflow && sched_state < SCHED_INTERRUPTING) { + if (heap_overflow && sched_state == SCHED_RUNNING) { // GC set the heap_overflow flag. We should throw an exception if we // can, or shut down otherwise. @@ -2660,7 +2662,7 @@ exitScheduler (bool wait_foreign USED_IF_THREADS) ASSERT(task->incall->tso == NULL); releaseCapability(cap); } - sched_state = SCHED_SHUTTING_DOWN; + ASSERT(sched_state == SCHED_SHUTTING_DOWN); shutdownCapabilities(task, wait_foreign); @@ -2749,6 +2751,7 @@ performMajorGC(void) void interruptStgRts(void) { + ASSERT(sched_state != SCHED_SHUTTING_DOWN); sched_state = SCHED_INTERRUPTING; interruptAllCapabilities(); #if defined(THREADED_RTS) diff --git a/rts/Schedule.h b/rts/Schedule.h index 49e094bb89..66cf8391f3 100644 --- a/rts/Schedule.h +++ b/rts/Schedule.h @@ -167,6 +167,7 @@ pushOnRunQueue (Capability *cap, StgTSO *tso) INLINE_HEADER StgTSO * popRunQueue (Capability *cap) { + ASSERT(cap->n_run_queue != 0); StgTSO *t = cap->run_queue_hd; ASSERT(t != END_TSO_QUEUE); cap->run_queue_hd = t->_link; |