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

Function LightSemaphore_Release

libctru/source/synchronization.c:411–426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

409}
410
411void LightSemaphore_Release(LightSemaphore* semaphore, s32 count)
412{
413 __dmb();
414
415 s32 old_count, new_count;
416 do
417 {
418 old_count = __ldrex(&semaphore->current_count);
419 new_count = old_count + count;
420 if (new_count >= semaphore->max_count)
421 new_count = semaphore->max_count;
422 } while (__strex(&semaphore->current_count, new_count));
423
424 if(old_count <= 0 || semaphore->num_threads_acq > 0)
425 syncArbitrateAddress(&semaphore->current_count, ARBITRATION_SIGNAL, count);
426}

Callers

nothing calls this directly

Calls 4

__dmbFunction · 0.85
__ldrexFunction · 0.85
__strexFunction · 0.85
syncArbitrateAddressFunction · 0.85

Tested by

no test coverage detected