================== Sys_TriggerEvent ================== */
| 241 | ================== |
| 242 | */ |
| 243 | void Sys_TriggerEvent(int index) { |
| 244 | assert(index >= 0 && index < MAX_TRIGGER_EVENTS); |
| 245 | |
| 246 | Sys_EnterCriticalSection(CRITICAL_SECTION_SYS); |
| 247 | |
| 248 | if (waiting[index]) { |
| 249 | #if SDL_VERSION_ATLEAST(3, 0, 0) |
| 250 | SDL_CondSignal(cond[index]); // in SDL3, this returns void and can't fail |
| 251 | #else // SDL2 and SDL1.2 |
| 252 | if (SDL_CondSignal(cond[index]) != 0) |
| 253 | common->Error("ERROR: SDL_CondSignal failed\n"); |
| 254 | #endif |
| 255 | } else { |
| 256 | // emulate windows behaviour: if no thread is waiting, leave the signal on so next wait keeps going |
| 257 | signaled[index] = true; |
| 258 | } |
| 259 | |
| 260 | Sys_LeaveCriticalSection(CRITICAL_SECTION_SYS); |
| 261 | } |
| 262 | |
| 263 | /* |
| 264 | ================== |
no test coverage detected