diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-09-27 15:48:41 +0000 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-10-24 21:00:36 -0400 |
commit | f6b4b492d9c112c30ddc0bda2338b143b56faf4c (patch) | |
tree | c063d0b3adeeb3d434f20d0f459078c3bc122a39 /rts/Capability.c | |
parent | 2781d68c5d94fd87435d6316c2d4118171e97b14 (diff) | |
download | haskell-f6b4b492d9c112c30ddc0bda2338b143b56faf4c.tar.gz |
rts: Clarify locking behavior of releaseCapability_
Diffstat (limited to 'rts/Capability.c')
-rw-r--r-- | rts/Capability.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/rts/Capability.c b/rts/Capability.c index 07141009a1..f13d076ca5 100644 --- a/rts/Capability.c +++ b/rts/Capability.c @@ -505,6 +505,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. * + * The caller must hold cap->lock and will still hold it after + * releaseCapability returns. + * * N.B. May need to take all_tasks_mutex. * * ------------------------------------------------------------------------- */ @@ -520,6 +523,7 @@ releaseCapability_ (Capability* cap, ASSERT_PARTIAL_CAPABILITY_INVARIANTS(cap,task); ASSERT_RETURNING_TASKS(cap,task); + ASSERT_LOCK_HELD(&cap->lock); cap->running_task = NULL; |