fix: use wait queue for blocking process
[lunaix-os.git] / lunaix-os / kernel / ds / waitq.c
index 5241a4ea9dff80bd64fb1f462ed4821cab9918f2..4b5abfd89055024a75bd4f220c808ef9c0b14e33 100644 (file)
@@ -1,6 +1,5 @@
 #include <lunaix/ds/waitq.h>
 #include <lunaix/process.h>
-#include <lunaix/sched.h>
 #include <lunaix/spike.h>
 
 void
@@ -11,8 +10,7 @@ pwait(waitq_t* queue)
 
     llist_append(&queue->waiters, &current_wq->waiters);
 
-    // FIXME centralize the state change.
-    __current->state = PS_BLOCKED;
+    block_current();
     sched_yieldk();
 }