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

Function LightSemaphore_TryAcquire

libctru/source/synchronization.c:394–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

392}
393
394int LightSemaphore_TryAcquire(LightSemaphore* semaphore, s32 count)
395{
396 s32 old_count;
397 do
398 {
399 old_count = __ldrex(&semaphore->current_count);
400 if (old_count < count)
401 {
402 __clrex();
403 return 1; // failure
404 }
405 } while (__strex(&semaphore->current_count, old_count - count));
406
407 __dmb();
408 return 0; // success
409}
410
411void LightSemaphore_Release(LightSemaphore* semaphore, s32 count)
412{

Callers

nothing calls this directly

Calls 4

__ldrexFunction · 0.85
__clrexFunction · 0.85
__strexFunction · 0.85
__dmbFunction · 0.85

Tested by

no test coverage detected