From 5f6c2bcf0d2f9c416134aba224d90a605f216818 Mon Sep 17 00:00:00 2001 From: Miguel Date: Fri, 28 Sep 2018 11:13:06 +0200 Subject: struggling with scheduler and userprog to view ppm files --- userspace/threading.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'userspace/threading.c') diff --git a/userspace/threading.c b/userspace/threading.c index 2ceaad3..2fd3b5e 100644 --- a/userspace/threading.c +++ b/userspace/threading.c @@ -1,17 +1,31 @@ #include #include "newcalls.h" +volatile unsigned int c=0xbeef; + +int inc(int i) +{ + i++; + if(i==0)i=1; + return i; +} + int main() { - int thread=_clone(); // we want two threads + + int thread=_clone(); if(thread!=0) // thread 1 { - while(1) printf("a\n"); + while(1) + { + c++; + } } + else // thread2 { - while(1) printf("b\n"); + while(1) printf("0x%08x\n",c); } } -- cgit v1.2.3