diff options
author | Anton Kling <anton@kling.gg> | 2024-02-25 01:45:19 +0100 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2024-02-25 01:45:19 +0100 |
commit | 4536dc81b4be9a62328826455664cd6d696df8fb (patch) | |
tree | e67f0b1e76c7d4c8a1366f645550d12069bd0cb0 /kernel/ipc.c | |
parent | a18da25e7355979d0f26cfd39dc0032172e8b135 (diff) |
IPC: Inform the scheduler the process is waiting for a IPC message
Diffstat (limited to 'kernel/ipc.c')
-rw-r--r-- | kernel/ipc.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/kernel/ipc.c b/kernel/ipc.c index bce346a..eb7c1b7 100644 --- a/kernel/ipc.c +++ b/kernel/ipc.c @@ -2,7 +2,6 @@ #include <interrupts.h> #include <ipc.h> #include <math.h> -#include <sched/scheduler.h> #include <stdbool.h> #include <string.h> @@ -45,6 +44,16 @@ int ipc_get_mailbox(u32 id, struct IpcMailbox **out) { return 1; } +int ipc_has_data(process_t *p) { + if (!p) { + p = get_current_task(); + } + struct IpcMailbox *handler = &p->ipc_mailbox; + u32 read_ptr = handler->read_ptr; + struct IpcMessage *ipc_message = &handler->data[read_ptr]; + return ipc_message->is_used; +} + int ipc_read(u8 *buffer, u32 length, u32 *sender_pid) { struct IpcMailbox *handler = &get_current_task()->ipc_mailbox; |