X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/a0655e5d30f3cdc73b1aaaa4825d8fae9f92ce4a..2e21eb2f39dd80aa166216381d5d402be943686e:/lunaix-os/kernel/ds/semaphore.c diff --git a/lunaix-os/kernel/ds/semaphore.c b/lunaix-os/kernel/ds/semaphore.c index 21d0e33..7b059a6 100644 --- a/lunaix-os/kernel/ds/semaphore.c +++ b/lunaix-os/kernel/ds/semaphore.c @@ -1,4 +1,5 @@ #include +#include void sem_init(struct sem_t *sem, unsigned int initial) { sem->counter = ATOMIC_VAR_INIT(initial); @@ -6,7 +7,7 @@ void sem_init(struct sem_t *sem, unsigned int initial) { void sem_wait(struct sem_t *sem) { while (!atomic_load(&sem->counter)) { - // TODO: yield the cpu + schedule(); } atomic_fetch_sub(&sem->counter, 1); }