Wrap tick API

This avoids to use the SDL timer API directly, and will allow to handle
generic ticks (possibly negative).
This commit is contained in:
Romain Vimont
2021-07-04 16:50:19 +02:00
parent 5524f378c8
commit 1ffabc6fcd
8 changed files with 58 additions and 16 deletions

View File

@@ -123,7 +123,12 @@ sc_cond_wait(sc_cond *cond, sc_mutex *mutex) {
}
bool
sc_cond_timedwait(sc_cond *cond, sc_mutex *mutex, uint32_t ms) {
sc_cond_timedwait(sc_cond *cond, sc_mutex *mutex, sc_tick delay) {
if (delay < 0) {
return false; // timeout
}
uint32_t ms = SC_TICK_TO_MS(delay);
int r = SDL_CondWaitTimeout(cond->cond, mutex->mutex, ms);
#ifndef NDEBUG
if (r < 0) {