summaryrefslogtreecommitdiff
path: root/src/user/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/test')
-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;
}