From 4087a6e7fc773ba4eb217dfc196dfe1eee84b25d Mon Sep 17 00:00:00 2001 From: Frans Kaashoek Date: Wed, 10 Aug 2022 20:35:42 -0400 Subject: Read and write p->killed using atomics --- kernel/console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'kernel/console.c') diff --git a/kernel/console.c b/kernel/console.c index 23a2d35..b8fa1de 100644 --- a/kernel/console.c +++ b/kernel/console.c @@ -89,7 +89,7 @@ consoleread(int user_dst, uint64 dst, int n) // wait until interrupt handler has put some // input into cons.buffer. while(cons.r == cons.w){ - if(myproc()->killed){ + if(__sync_add_and_fetch(&(myproc()->killed), 0)){ release(&cons.lock); return -1; } -- cgit v1.2.3 From 975f3b31d3fac2c271df3107263df6ae454a98be Mon Sep 17 00:00:00 2001 From: Frans Kaashoek Date: Thu, 11 Aug 2022 07:23:17 -0400 Subject: Clean up using killed() --- kernel/console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'kernel/console.c') diff --git a/kernel/console.c b/kernel/console.c index b8fa1de..d6eb209 100644 --- a/kernel/console.c +++ b/kernel/console.c @@ -89,7 +89,7 @@ consoleread(int user_dst, uint64 dst, int n) // wait until interrupt handler has put some // input into cons.buffer. while(cons.r == cons.w){ - if(__sync_add_and_fetch(&(myproc()->killed), 0)){ + if(killed(myproc())){ release(&cons.lock); return -1; } -- cgit v1.2.3