rts/nonmoving: Catch failure of createOSThread
authorBen Gamari <ben@smart-cactus.org>
Thu, 7 Nov 2019 16:45:21 +0000 (11:45 -0500)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Fri, 8 Nov 2019 17:10:01 +0000 (12:10 -0500)
rts/sm/NonMoving.c

index 50cf784..20ec5a4 100644 (file)
@@ -896,8 +896,10 @@ void nonmovingCollect(StgWeak **dead_weaks, StgTSO **resurrected_threads)
         concurrent_coll_running = true;
         nonmoving_write_barrier_enabled = true;
         debugTrace(DEBUG_nonmoving_gc, "Starting concurrent mark thread");
-        createOSThread(&mark_thread, "non-moving mark thread",
-                       nonmovingConcurrentMark, mark_queue);
+        if (createOSThread(&mark_thread, "non-moving mark thread",
+                           nonmovingConcurrentMark, mark_queue) != 0) {
+            barf("nonmovingCollect: failed to spawn mark thread: %s", strerror(errno));
+        }
     } else {
         nonmovingConcurrentMark(mark_queue);
     }