[commit: ghc] master: forkProcess: fix task mutex release order (e261b85)
git at git.haskell.org
git at git.haskell.org
Fri Mar 2 16:17:07 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/e261b8523eb547b93b8b9e194bc2566350e7cc60/ghc
>---------------------------------------------------------------
commit e261b8523eb547b93b8b9e194bc2566350e7cc60
Author: Ömer Sinan Ağacan <omeragacan at gmail.com>
Date: Fri Mar 2 11:15:03 2018 -0500
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
>---------------------------------------------------------------
e261b8523eb547b93b8b9e194bc2566350e7cc60
rts/Schedule.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/rts/Schedule.c b/rts/Schedule.c
index f1363e4..cdb9659 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
More information about the ghc-commits
mailing list