diff options
author | Marvin Borner | 2021-01-15 16:34:19 +0100 |
---|---|---|
committer | Marvin Borner | 2021-01-15 16:34:19 +0100 |
commit | 41cba1de51b328979ff2d0261b4141bb4e128fe6 (patch) | |
tree | 88ea7bda9e7a675ed0e043ea8662ea9cf3767ce3 /kernel/features/proc.c | |
parent | d3924f541f36bc08fed87f25ec7fc6e64b86e511 (diff) |
Implemented basic dev ready-state waiting
Diffstat (limited to 'kernel/features/proc.c')
-rw-r--r-- | kernel/features/proc.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/kernel/features/proc.c b/kernel/features/proc.c index f792824..af6a307 100644 --- a/kernel/features/proc.c +++ b/kernel/features/proc.c @@ -105,7 +105,7 @@ void proc_exit(struct proc *proc, int status) int res = 0; struct node *iterator = proc_list->head; - while (iterator != NULL) { + while (iterator) { if (iterator->data == proc) { res = 1; list_remove(proc_list, iterator); @@ -131,6 +131,21 @@ void proc_yield(struct regs *r) scheduler(r); } +void proc_enable_waiting(u32 dev_id) +{ + printf("ENABLING %d\n", dev_id); + struct node *iterator = proc_list->head; + while (iterator) { + struct proc *p = iterator->data; + printf("\t-> %s: %d\n", p->name, p->waits_for); + if (p && p->waits_for && p->waits_for == dev_id) { + //printf("WAKING %s\n", p->name); + p->state = PROC_RUNNING; + } + iterator = iterator->next; + } +} + struct proc *proc_make(void) { struct proc *proc = malloc(sizeof(*proc)); |