Wake the completion thread for a new callback only when its value is already reached: the replay's callbacks wait for the submission it records, whose submit wakes the thread anyway

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-10-27 00:56:48 +03:00
1 parent bcbbcb0b1a
commit 895aa43ab9
1 file changed
+3 -1
+3 -1
View File
@@ -381,7 +381,9 @@ void vk_completion_add(uint64_t fence, void (*fn)(void *), void *arg) {
}
}
queue[qhead + qn++] = (Pending){fence, fn, arg};
WakeAllConditionVariable(&cv_work);
// The completion thread sleeps only while nothing is issued beyond done: a callback for a later value (the replay's,
// for the submission it records: counter reports, freed resources) becomes due through the submit, which wakes it.
if (fence <= done) WakeAllConditionVariable(&cv_work);
ReleaseSRWLockExclusive(&st_lock);
}