rts: Ensure that forkOS releases Task on termination
authorBen Gamari <bgamari.foss@gmail.com>
Thu, 1 Feb 2018 02:37:21 +0000 (21:37 -0500)
committerBen Gamari <ben@smart-cactus.org>
Thu, 1 Feb 2018 04:51:19 +0000 (23:51 -0500)
Test Plan: validate

Reviewers: simonmar, erikd

Reviewed By: simonmar

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14725

Differential Revision: https://phabricator.haskell.org/D4346

(cherry picked from commit 382c12d18f3d64e01502a5c8bbc64d4aa4842e3e)

rts/posix/OSThreads.c
rts/win32/OSThreads.c

index e2471a2..9cf42aa 100644 (file)
@@ -223,6 +223,7 @@ forkOS_createThreadWrapper ( void * entry )
     cap = rts_lock();
     rts_evalStableIO(&cap, (HsStablePtr) entry, NULL);
     rts_unlock(cap);
+    rts_done();
     return NULL;
 }
 
index ad42340..b1a98ce 100644 (file)
@@ -236,6 +236,7 @@ forkOS_createThreadWrapper ( void * entry )
     cap = rts_lock();
     rts_evalStableIO(&cap, (HsStablePtr) entry, NULL);
     rts_unlock(cap);
+    rts_done();
     return 0;
 }