diff options
| author | Ada Christine <adachristine18@gmail.com> | 2022-02-15 15:00:53 +0000 |
|---|---|---|
| committer | Ada Christine <adachristine18@gmail.com> | 2022-02-15 15:00:53 +0000 |
| commit | 5fc386102380e6c15c81df4fd750f54641535eaa (patch) | |
| tree | c3aed0635aa10a80e1bbbe46a80e4e67f2be2c39 /kc/core/task.c | |
| parent | 0c1bc025700656ce17bbd71f7d149744d65b7fb6 (diff) | |
beginning to things out into cpu-dependent and cpu-independent code
Diffstat (limited to 'kc/core/task.c')
| -rw-r--r-- | kc/core/task.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/kc/core/task.c b/kc/core/task.c index 09156d4..79fae5f 100644 --- a/kc/core/task.c +++ b/kc/core/task.c @@ -4,13 +4,12 @@ #include "panic.h" #include "cpu.h" #include "kprint.h" +#include "cpu/irq.h" struct kc_thread *current_task = NULL; struct kc_thread *first_ready_task = NULL; struct kc_thread *last_ready_task = NULL; -static int schedule_lock_cnt = 0; - static void lock_scheduler(void); static void unlock_scheduler(void); static void set_thread_status(enum kc_thread_status status); @@ -49,20 +48,12 @@ void task_schedule(void) static void lock_scheduler(void) { - __asm__ volatile ("cli;"); - schedule_lock_cnt++; + irq_lock(); } static void unlock_scheduler(void) { - if (schedule_lock_cnt >= 1) - { - schedule_lock_cnt--; - } - if (schedule_lock_cnt == 0) - { - __asm__ volatile ("sti;"); - } + irq_unlock(); } static void unblock_thread(struct kc_thread *thread) |
