rts: Note functions which must take all_tasks_mutex.
authorBen Gamari <ben@smart-cactus.org>
Fri, 2 Mar 2018 16:13:14 +0000 (11:13 -0500)
committerBen Gamari <ben@smart-cactus.org>
Fri, 2 Mar 2018 16:16:47 +0000 (11:16 -0500)
rts/Capability.c
rts/Schedule.c
rts/Task.c

index 03b2a86..f9141ee 100644 (file)
@@ -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)
index cdb9659..b8306df 100644 (file)
@@ -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
 
index fc928d5..758ae10 100644 (file)
@@ -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)
 {