[commit: ghc] master: rts: Note functions which must take all_tasks_mutex. (8dab89b)

git at git.haskell.org git at git.haskell.org
Fri Mar 2 16:17:04 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/8dab89b4d148d322cd7ac8c374be3342ab017297/ghc

>---------------------------------------------------------------

commit 8dab89b4d148d322cd7ac8c374be3342ab017297
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Fri Mar 2 11:13:14 2018 -0500

    rts: Note functions which must take all_tasks_mutex.


>---------------------------------------------------------------

8dab89b4d148d322cd7ac8c374be3342ab017297
 rts/Capability.c | 3 +++
 rts/Schedule.c   | 1 +
 rts/Task.c       | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/rts/Capability.c b/rts/Capability.c
index 03b2a86..f9141ee 100644
--- a/rts/Capability.c
+++ b/rts/Capability.c
@@ -498,6 +498,9 @@ giveCapabilityToTask (Capability *cap USED_IF_DEBUG, Task *task)
  *
  * The current Task (cap->task) releases the Capability.  The Capability is
  * marked free, and if there is any work to do, an appropriate Task is woken up.
+ *
+ * N.B. May need to take all_tasks_mutex.
+ *
  * ------------------------------------------------------------------------- */
 
 #if defined(THREADED_RTS)
diff --git a/rts/Schedule.c b/rts/Schedule.c
index cdb9659..b8306df 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -2005,6 +2005,7 @@ forkProcess(HsStablePtr *entry
         RELEASE_LOCK(&task->lock);
 
 #if defined(THREADED_RTS)
+        /* N.B. releaseCapability_ below may need to take all_tasks_mutex */
         RELEASE_LOCK(&all_tasks_mutex);
 #endif
 
diff --git a/rts/Task.c b/rts/Task.c
index fc928d5..758ae10 100644
--- a/rts/Task.c
+++ b/rts/Task.c
@@ -199,6 +199,7 @@ freeTask (Task *task)
     stgFree(task);
 }
 
+/* Must take all_tasks_mutex */
 static Task*
 newTask (bool worker)
 {
@@ -443,6 +444,7 @@ workerStart(Task *task)
     scheduleWorker(cap,task);
 }
 
+/* N.B. must take all_tasks_mutex */
 void
 startWorkerTask (Capability *cap)
 {



More information about the ghc-commits mailing list