Fix an assertion that could randomly fail
authorSimon Marlow <marlowsd@gmail.com>
Thu, 4 Aug 2016 14:57:37 +0000 (15:57 +0100)
committerSimon Marlow <marlowsd@gmail.com>
Fri, 5 Aug 2016 09:13:28 +0000 (10:13 +0100)
commitce13a9a9f57d61170837532948fed8bc1924a7ab
treef442352b3fa558e8b8de8328bc8351995ffd9cc9
parentca7e1ad346362ba68b430550110e74421b19193f
Fix an assertion that could randomly fail

Summary:
ASSERT_THREADED_CAPABILITY_INVARIANTS was testing properties of the
returning_tasks queue, but that requires cap->lock to access safely.
This assertion would randomly fail if stressed enough.

Instead I've removed it from the catch-all
ASSERT_PARTIAL_CAPABILITIY_INVARIANTS and made it a separate assertion
only called under cap->lock.

Test Plan:
```
cd testsuite/tests/concurrent/should_run
make TEST=setnumcapabilities001 WAY=threaded1 EXTRA_HC_OPTS=-with-rtsopts=-DS CLEANUP=0
while true; do ./setnumcapabilities001.run/setnumcapabilities001 4 9 2000 || break; done
```

Reviewers: niteria, bgamari, ezyang, austin, erikd

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2440

GHC Trac Issues: #10860
rts/Capability.c
rts/Capability.h