summaryrefslogtreecommitdiff
path: root/src/user/test/main.c
diff options
context:
space:
mode:
authorAlex AUVOLAT <alexis211@gmail.com>2012-05-01 17:42:36 +0200
committerAlex AUVOLAT <alexis211@gmail.com>2012-05-01 17:42:36 +0200
commite9683297bf480f9590b0e5796f4520fb430e2e03 (patch)
tree93ef75cd154edf4c342d0a22cd56eb3670feb2b5 /src/user/test/main.c
parente8cf65c07d78e3cfbac953b1b97c51998a5900df (diff)
downloadTCE-e9683297bf480f9590b0e5796f4520fb430e2e03.tar.gz
TCE-e9683297bf480f9590b0e5796f4520fb430e2e03.zip
Now using Doug Lea's malloc for userland too. And improved stability.
Diffstat (limited to 'src/user/test/main.c')
-rw-r--r--src/user/test/main.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/src/user/test/main.c b/src/user/test/main.c
index d890850..945c530 100644
--- a/src/user/test/main.c
+++ b/src/user/test/main.c
@@ -1,50 +1,41 @@
#include <tce/syscall.h>
-#include <tce/mem.h>
#include <stdlib.h>
-static volatile int threads = 0;
-
void thread_cascade(void* d) {
int n = (int)d;
- threads++;
-
if (d == 0) {
//printk("{#} 0 cascade element started => end\n");
- printk("{#}0end\t");
+ printk("*");
} else {
if (n < 0) {
//printk("{#} - cascade element started\n");
- printk("{#}-\t");
+ printk("-");
n = 0 - n;
} else {
//printk("{#} + cascade element started\n");
- printk("{#}+\t");
+ printk("+");
}
//printk("{#} FORK + ...\n");
- printk("{#}F+\t");
+ printk(">");
thread_new(thread_cascade, (void*)(n - 1));
//printk("{#} FORK - ...\n");
- printk("{#}F-\t");
+ printk("<");
thread_new(thread_cascade, (void*)(1 - n));
//printk("{#} Thread cascade element finished.\n");
- printk("{#}end\t");
+ printk(".");
}
-
- threads--;
}
int main() {
printk("Hi world from test module !\n");
- printk("{1} Creating thread cascade len:4\n");
- thread_new(thread_cascade, (void*)7);
+ printk(" -> Creating thread cascade (total 2**8 = 256 threads)\n");
+ thread_new(thread_cascade, (void*)8);
- printk("{1} Thread now sleeping...\n");
+ printk(" -> Main thread now sleeping... forever...\n");
while (1) {
thread_sleep(1000);
- if (threads == 0) break;
}
- printk("{1} Everybody seems to be done here, exiting...\n");
return 0;
}