MCPcopy Create free account
hub / github.com/devkitPro/libctru / LightEvent_WaitTimeout

Function LightEvent_WaitTimeout

libctru/source/synchronization.c:330–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

328}
329
330int LightEvent_WaitTimeout(LightEvent* event, s64 timeout_ns)
331{
332 Result timeoutRes = 0x09401BFE;
333 Result res = 0;
334
335 while (res != timeoutRes)
336 {
337 if (event->state == CLEARED_STICKY)
338 {
339 res = syncArbitrateAddressWithTimeout(&event->state, ARBITRATION_WAIT_IF_LESS_THAN_TIMEOUT, SIGNALED_ONESHOT, timeout_ns);
340 return res == timeoutRes;
341 }
342
343 if (event->state != CLEARED_ONESHOT)
344 {
345 if (event->state == SIGNALED_STICKY)
346 return 0;
347
348 if (event->state == SIGNALED_ONESHOT && LightEvent_TryReset(event))
349 return 0;
350 }
351
352 res = syncArbitrateAddressWithTimeout(&event->state, ARBITRATION_WAIT_IF_LESS_THAN_TIMEOUT, SIGNALED_ONESHOT, timeout_ns);
353 }
354
355 return res == timeoutRes;
356}
357
358void LightSemaphore_Init(LightSemaphore* semaphore, s16 initial_count, s16 max_count)
359{

Callers

nothing calls this directly

Calls 2

LightEvent_TryResetFunction · 0.85

Tested by

no test coverage detected