From 7a23d95b6e432170d6575f515616e5936d53c85e Mon Sep 17 00:00:00 2001 From: Kimplul Date: Wed, 30 Oct 2024 02:32:02 +0200 Subject: bookkeeping --- src/tcb.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/tcb.c') diff --git a/src/tcb.c b/src/tcb.c index 1281da2..818d4e7 100644 --- a/src/tcb.c +++ b/src/tcb.c @@ -90,6 +90,13 @@ static id_t __alloc_tid(struct tcb *t) return ERR_NF; } +/** + * Initialize thread that isn't bound to any parent process, i.e. it will become + * a process in itself. + * + * @param t Partially constructed tcb to construct further. + * @return OK/ERR_OOMEM. + */ static stat_t __init_free_thread(struct tcb *t) { if (!(t->proc.vmem = create_vmem())) @@ -102,7 +109,7 @@ static stat_t __init_free_thread(struct tcb *t) if (!(t->rpc.vmem = create_vmem())) { destroy_vmem(t->proc.vmem); - return NULL; + return ERR_OOMEM; } if (setup_rpc_stack(t)) { @@ -120,6 +127,13 @@ static stat_t __init_free_thread(struct tcb *t) return OK; } +/** + * Initialize thread that is bound to some parent process. + * + * @param p Parent tcb. + * @param t Partially constructed tcb to construct further. + * @return OK/ERR_OOMEM. + */ static stat_t __init_owned_thread(struct tcb *p, struct tcb *t) { t->eid = p->rid; @@ -220,7 +234,6 @@ struct tcb *create_proc(struct tcb *p) * Destroy data associated with thread. * * @param t Thread whose data to destroy. - * @return \ref OK. */ static void __destroy_thread_data(struct tcb *t) { -- cgit v1.3