MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / semaphore_wait

Function semaphore_wait

examples/utest/testcases/mm/semaphore.h:24–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22}
23
24void semaphore_wait(semaphore_t *sem)
25{
26 int count;
27 do {
28 count = atomic_load(&sem->count);
29 } while (count == 0 || !atomic_compare_exchange_weak(&sem->count, &count, count - 1));
30}
31
32void semaphore_signal(semaphore_t *sem)
33{

Callers 2

group1_entryFunction · 0.85
group2_entryFunction · 0.85

Calls

no outgoing calls

Tested by 2

group1_entryFunction · 0.68
group2_entryFunction · 0.68