diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-09-27 15:49:03 +0000 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-10-24 21:00:36 -0400 |
commit | 65219810a41f1c903838185a766baeba8954cc88 (patch) | |
tree | e8978410b5a6026707f6087cd51028f5c910a0e6 /rts/Schedule.c | |
parent | f6b4b492d9c112c30ddc0bda2338b143b56faf4c (diff) | |
download | haskell-65219810a41f1c903838185a766baeba8954cc88.tar.gz |
rts: Add assertions for task ownership of capabilities
Diffstat (limited to 'rts/Schedule.c')
-rw-r--r-- | rts/Schedule.c | 5 |
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. |