Fixed locking around notification

Deduplication locking had test_and_set incorrect direction.
This commit is contained in:
Matthew Parkinson
2021-12-14 11:49:39 +00:00
committed by Matthew Parkinson
parent f398545154
commit 7768765fe8

View File

@@ -146,18 +146,17 @@ namespace snmalloc
// Depulicate calls into here, and make single threaded.
if (lock.test_and_set())
{
timers.apply_all([time_ms](PalTimerObject* curr) {
if (
(curr->last_run == 0) ||
((time_ms - curr->last_run) > curr->repeat))
{
curr->last_run = time_ms;
curr->pal_notify(curr);
}
});
lock.clear();
}
return;
timers.apply_all([time_ms](PalTimerObject* curr) {
if (
(curr->last_run == 0) || ((time_ms - curr->last_run) > curr->repeat))
{
curr->last_run = time_ms;
curr->pal_notify(curr);
}
});
lock.clear();
}
};
} // namespace snmalloc