update readme introduction part, add demo screen-shot
[lunaix-os.git] / lunaix-os / kernel / ds / semaphore.c
index 84c01007b857de89d54819d9023a84846e4f6124..b4d0674438b78323eab6acbd8bd9a87c8650a1c8 100644 (file)
@@ -1,5 +1,5 @@
 #include <lunaix/ds/semaphore.h>
-#include <lunaix/sched.h>
+#include <lunaix/kpreempt.h>
 
 void
 sem_init(struct sem_t* sem, unsigned int initial)
@@ -12,6 +12,7 @@ sem_wait(struct sem_t* sem)
 {
     while (!atomic_load(&sem->counter)) {
         // FIXME: better thing like wait queue
+        preempt_current();
     }
     atomic_fetch_sub(&sem->counter, 1);
 }