A Small Cooperative Multitasking Kernel

Dependencies:   mbed

Revision:
0:73b89fc74e9f
diff -r 000000000000 -r 73b89fc74e9f tasks-printf-c.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tasks-printf-c.h	Sun Jul 24 17:15:42 2011 +0000
@@ -0,0 +1,32 @@
+#include "kernel.h"
+#include <stdio.h>
+
+static void task_zero(void);
+static void task_one(void);
+
+struct ou_task ou_tasks[] = {
+    { task_zero, 2, 0, 0, 0, NULL },
+    { task_one,  1, 0, 0, 0, NULL }
+};
+
+const unsigned ou_ntasks = sizeof(ou_tasks)/sizeof(struct ou_task);
+
+OU_TASK(task_zero)
+    OU_WAIT(100);
+    printf("hello\r\n");
+    OU_WAIT(100);
+    printf("world\r\n");
+OU_ENDTASK
+
+OU_TASK(task_one)
+    OU_WAIT(100);
+    printf("goodbye\r\n");
+    OU_WAIT(100);
+    printf("cruel\r\n");
+    OU_WAIT(100);
+    printf("world...\r\n");
+    for(;;) {
+        OU_WAIT(50);
+        printf("loop\r\n");
+    }
+OU_ENDTASK
\ No newline at end of file