diff options
author | Alex AUVOLAT <alexis211@gmail.com> | 2012-05-01 14:55:18 +0200 |
---|---|---|
committer | Alex AUVOLAT <alexis211@gmail.com> | 2012-05-01 14:55:18 +0200 |
commit | e8cf65c07d78e3cfbac953b1b97c51998a5900df (patch) | |
tree | 7b75741a1d38b5da1ee79e877709b6b4723c4713 /src/user/test | |
parent | 5cac9acd3aedc8043d4272d93c56805c46ff6214 (diff) | |
download | TCE-e8cf65c07d78e3cfbac953b1b97c51998a5900df.tar.gz TCE-e8cf65c07d78e3cfbac953b1b97c51998a5900df.zip |
Now using Doug Lea's malloc in kernel land. Next: same in userland.
Diffstat (limited to 'src/user/test')
-rw-r--r-- | src/user/test/main.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/user/test/main.c b/src/user/test/main.c index 14f6363..d890850 100644 --- a/src/user/test/main.c +++ b/src/user/test/main.c @@ -2,9 +2,13 @@ #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"); @@ -26,15 +30,21 @@ void thread_cascade(void* d) { //printk("{#} Thread cascade element finished.\n"); printk("{#}end\t"); } + + threads--; } int main() { printk("Hi world from test module !\n"); printk("{1} Creating thread cascade len:4\n"); - thread_new(thread_cascade, (void*)4); + thread_new(thread_cascade, (void*)7); printk("{1} Thread now sleeping...\n"); - while (1) thread_sleep(1000); + while (1) { + thread_sleep(1000); + if (threads == 0) break; + } + printk("{1} Everybody seems to be done here, exiting...\n"); return 0; } |