| 328 | } |
| 329 | |
| 330 | int 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 | |
| 358 | void LightSemaphore_Init(LightSemaphore* semaphore, s16 initial_count, s16 max_count) |
| 359 | { |
nothing calls this directly
no test coverage detected