+
+ // Simulate spurious wake-ups, timeouts each time with
+ // a 10% probability if we haven't been woken up already
+ if (!awoken && hasTimeout &&
+ DeterministicSchedule::getRandNumber(100) < 10) {
+ assert(futexQueues.count(this) != 0 && &futexQueues[this] == &queue);
+ queue.erase(ours);
+ if (queue.empty()) {
+ futexQueues.erase(this);
+ }
+ // Simulate ETIMEDOUT 90% of the time and other failures
+ // remaining time
+ result = DeterministicSchedule::getRandNumber(100) >= 10
+ ? FutexResult::TIMEDOUT
+ : FutexResult::INTERRUPTED;
+ break;
+ }