summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/futex_map.hh11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/sim/futex_map.hh b/src/sim/futex_map.hh
index 3d34109be..5e60f7c37 100644
--- a/src/sim/futex_map.hh
+++ b/src/sim/futex_map.hh
@@ -153,9 +153,16 @@ class FutexMap : public std::unordered_map<FutexKey, WaiterList>
auto &waiterList = it->second;
while (!waiterList.empty() && woken_up < count) {
- waiterList.front().tc->activate();
+ // Threads may be woken up by access to locked
+ // memory addresses outside of syscalls, so we
+ // must only count threads that were actually
+ // woken up by this syscall.
+ auto& tc = waiterList.front().tc;
+ if (tc->status() != ThreadContext::Active) {
+ tc->activate();
+ woken_up++;
+ }
waiterList.pop_front();
- woken_up++;
}
if (waiterList.empty())