-
Committer:
Tarmac
-
Author(s):
Christopher James Halse Rogers
-
Date:
2016-10-21 09:50:52 UTC
-
mfrom:
(3745.3.12 shared-mutex)
-
Revision ID:
tarmac-20161021095052-3a7e7ytbhiefh8og
TestPosixRWMutex: Resolve occasional deadlocks
trigger_next_reader() would increment the current reader_to_run and then notify all waiters that they might be ready to run. However, this could be run *twice* before the waiting thread was scheduled. In that case, the waiting thread would wake up, notice that it's still not meant to be running, and go back to sleep - we'd miss our turn to run.
So, make trigger_next_reader() idempotent.
Also make some tweaks that seem to reduce valgrind runtime significantly, and increase the timeout.
Fixes: https://bugs.launchpad.net/mir/+bug/1633920. Fixes: https://bugs.launchpad.net/bugs/1633920.
Approved by mir-ci-bot, Daniel van Vugt, Cemil Azizoglu, Alan Griffiths.