- IF_DEBUG(scheduler, sched_belch("deadlocked, checking for black holes..."));
- detectBlackHoles();
- if (run_queue_hd == END_TSO_QUEUE) {
- StgMainThread *m;
- for (m = main_threads; m != NULL; m = m->link) {
+ IF_DEBUG(scheduler, sched_belch("deadlocked, forcing major GC..."));
+ GarbageCollect(GetRoots,rtsTrue);
+ if (blocked_queue_hd == END_TSO_QUEUE
+ && run_queue_hd == END_TSO_QUEUE
+ && sleeping_queue == END_TSO_QUEUE) {
+ IF_DEBUG(scheduler, sched_belch("still deadlocked, checking for black holes..."));
+ detectBlackHoles();
+ if (run_queue_hd == END_TSO_QUEUE) {
+ StgMainThread *m = main_threads;
+#ifdef SMP
+ for (; m != NULL; m = m->link) {
+ m->ret = NULL;
+ m->stat = Deadlock;
+ pthread_cond_broadcast(&m->wakeup);
+ }
+ main_threads = NULL;
+#else