9os

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit edbf49894b0b94bbbd67b229fe6a270559e681ce
parent b2a715aab2b262c5e75b82631756b13a14d4a550
Author: Roberto E. Vargas Caballero <roberto.vargas@midokura.com>
Date:   Fri, 18 Nov 2022 11:48:06 +0100

os9: Modify newtask() to allow pid 0

Pid 0 is reserved for the initialization task and newtask()
was returning 1 for the first task.

Diffstat:
Msrc/os9/proc.c | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/os9/proc.c b/src/os9/proc.c @@ -201,7 +201,7 @@ newtask(void) { int pid; Task *tp; - static int last; + static int last = -1; static mutex_t m; assert(NR_TASKS < MAXTID); @@ -212,7 +212,7 @@ newtask(void) for (;;) { if (pid == MAXTID) - pid = 0; + pid = -1; pid++; if (pid == last) goto err; @@ -532,7 +532,6 @@ inittask(void) if ((tp = newtask()) == NULL) return NULL; - tp->pid = 0; tp->text = NULL; tp->data = NULL;