summaryrefslogtreecommitdiff
path: root/rts/Schedule.c
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-09-27 15:49:03 +0000
committerBen Gamari <ben@smart-cactus.org>2020-10-24 21:00:36 -0400
commit65219810a41f1c903838185a766baeba8954cc88 (patch)
treee8978410b5a6026707f6087cd51028f5c910a0e6 /rts/Schedule.c
parentf6b4b492d9c112c30ddc0bda2338b143b56faf4c (diff)
downloadhaskell-65219810a41f1c903838185a766baeba8954cc88.tar.gz
rts: Add assertions for task ownership of capabilities
Diffstat (limited to 'rts/Schedule.c')
-rw-r--r--rts/Schedule.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c
index 41d0dba953..c04907f157 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -203,6 +203,7 @@ schedule (Capability *initialCapability, Task *task)
// Pre-condition: this task owns initialCapability.
// The sched_mutex is *NOT* held
// NB. on return, we still hold a capability.
+ ASSERT_FULL_CAPABILITY_INVARIANTS(cap, task);
debugTrace (DEBUG_sched, "cap %d: schedule()", initialCapability->no);
@@ -210,6 +211,7 @@ schedule (Capability *initialCapability, Task *task)
// Scheduler loop starts here:
while (1) {
+ ASSERT_FULL_CAPABILITY_INVARIANTS(cap, task);
// Check whether we have re-entered the RTS from Haskell without
// going via suspendThread()/resumeThread (i.e. a 'safe' foreign
@@ -2626,8 +2628,9 @@ scheduleWaitThread (StgTSO* tso, /*[out]*/HaskellObj* ret, Capability **pcap)
#if defined(THREADED_RTS)
void scheduleWorker (Capability *cap, Task *task)
{
- // schedule() runs without a lock.
+ ASSERT_FULL_CAPABILITY_INVARIANTS(cap, task);
cap = schedule(cap,task);
+ ASSERT_FULL_CAPABILITY_INVARIANTS(cap, task);
// On exit from schedule(), we have a Capability, but possibly not
// the same one we started with.