From a3e45d5dcaf1bf3a9e684b5fcc301413ec994a9b Mon Sep 17 00:00:00 2001 From: Kimplul Date: Wed, 9 Nov 2022 16:27:23 +0200 Subject: add basic IPI structure --- include/apos/tcb.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'include/apos/tcb.h') diff --git a/include/apos/tcb.h b/include/apos/tcb.h index b92cd10..0368957 100644 --- a/include/apos/tcb.h +++ b/include/apos/tcb.h @@ -146,6 +146,9 @@ struct tcb { /** Notifcation state of thread. */ enum tcb_notify notify_state; + + /** Whether thread has gotten an IPI */ + bool ipi; }; /** @@ -265,6 +268,14 @@ stat_t detach_proc(struct tcb *r, struct tcb *t); */ struct tcb *cur_tcb(); +/** + * Get thread currently running on cpu \p cpu_id. + * + * @param cpu_id CPU whose currently running thread to get. + * @return \ref tcb running on cpu. + */ +struct tcb *cpu_tcb(id_t cpu_id); + /** * Get currently executing process. * @@ -337,4 +348,12 @@ stat_t alloc_stacks(struct tcb *t); */ void set_return(struct tcb *t, vm_t r); +/** + * Check whether \p t is currently running on some cpu. + * + * @param t \ref tcb to check. + * @return \c true if it is running, \c false otherwise. + */ +bool running(struct tcb *t); + #endif /* APOS_TCB_H */ -- cgit v1.3