From fbb4c0944422f860484142010bb9f366f3e87bf8 Mon Sep 17 00:00:00 2001 From: Frans Kaashoek Date: Tue, 31 Jan 2017 20:21:14 -0500 Subject: Read curproc from cpu structure, but be careful because after a schedule event myproc() points to a different thread. myproc(); sched(); myproc(); // this proc maybe different than the one before sched Thus, in a function that operates on one thread better to retrieve the current process once at the start of the function. --- defs.h | 1 + 1 file changed, 1 insertion(+) (limited to 'defs.h') diff --git a/defs.h b/defs.h index 67ea9f6..5e049ae 100644 --- a/defs.h +++ b/defs.h @@ -108,6 +108,7 @@ void exit(void); int fork(void); int growproc(int); int kill(int); +struct proc* myproc(); void pinit(void); void procdump(void); void scheduler(void) __attribute__((noreturn)); -- cgit v1.2.3