diff options
author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2018-03-02 11:15:03 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-03-02 11:16:47 -0500 |
commit | e261b8523eb547b93b8b9e194bc2566350e7cc60 (patch) | |
tree | 4d84c3b1242d3bb35aa82ef9091dc1ac4b6f9ac7 /rts/Schedule.c | |
parent | b8f03bbe16af7a09b494a33fbbe523ecd82f1a50 (diff) | |
download | haskell-e261b8523eb547b93b8b9e194bc2566350e7cc60.tar.gz |
forkProcess: fix task mutex release order
`all_tasks_mutex` should be released before calling `releaseCapability_`
in the parent process as `releaseCapability_` spawns worker tasks in
some cases.
Reviewers: bgamari, erikd, simonmar
Subscribers: rwbarton, thomie, carter
GHC Trac Issues: #14538
Differential Revision: https://phabricator.haskell.org/D4460
Diffstat (limited to 'rts/Schedule.c')
-rw-r--r-- | rts/Schedule.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c index f1363e46ee..cdb9659d83 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -2004,15 +2004,15 @@ forkProcess(HsStablePtr *entry RELEASE_LOCK(&stable_mutex); RELEASE_LOCK(&task->lock); +#if defined(THREADED_RTS) + RELEASE_LOCK(&all_tasks_mutex); +#endif + for (i=0; i < n_capabilities; i++) { releaseCapability_(capabilities[i],false); RELEASE_LOCK(&capabilities[i]->lock); } -#if defined(THREADED_RTS) - RELEASE_LOCK(&all_tasks_mutex); -#endif - boundTaskExiting(task); // just return the pid |