summaryrefslogtreecommitdiff
path: root/src/user/app/test/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/app/test/main.c')
-rw-r--r--src/user/app/test/main.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/user/app/test/main.c b/src/user/app/test/main.c
index d235c57..939a15a 100644
--- a/src/user/app/test/main.c
+++ b/src/user/app/test/main.c
@@ -1,12 +1,11 @@
#include <tce/syscall.h>
+#include <stdio.h>
-int threads = 0;
+int threads = 1;
void thread_cascade(void* d) {
int n = (int)d;
- threads ++;
-
if (d == 0) {
//printk("{#} 0 cascade element started => end\n");
printk("*");
@@ -21,6 +20,7 @@ void thread_cascade(void* d) {
}
//printk("{#} FORK + ...\n");
printk(">");
+ threads += 2;
thread_new(thread_cascade, (void*)(n - 1));
//printk("{#} FORK - ...\n");
printk("<");
@@ -32,6 +32,13 @@ void thread_cascade(void* d) {
threads--;
}
+void useless_thread(void* d) {
+ while(1) {
+ printk("~");
+ schedule();
+ }
+}
+
int main(char** args) {
char**a;
if (args != 0) {
@@ -44,13 +51,16 @@ int main(char** args) {
}
printk("(test) Creating thread cascade (total 2**5 = 32 threads)\n");
+ thread_new(useless_thread, 0);
thread_new(thread_cascade, (void*)5);
while (1) {
- thread_sleep(100);
+ schedule();
if (threads == 0) break;
}
printk("\n(test) Test process exiting. Press the super key to go to the home terminal.\n");
+ printf("(test) End.\n");
+
return 0;
}