dol: initial dol commit
[jump.git] / dol / examples / examplesingleprocess / src / task.c
diff --git a/dol/examples/examplesingleprocess/src/task.c b/dol/examples/examplesingleprocess/src/task.c
new file mode 100644 (file)
index 0000000..9544c0b
--- /dev/null
@@ -0,0 +1,21 @@
+#include <stdio.h>
+
+#include "task.h"
+
+void task_init(DOLProcess *p) {
+    sprintf(p->local->name, "task_%d", GETINDEX(0));
+    p->local->index = 0;
+}
+
+int task_fire(DOLProcess *p) {
+    if (p->local->index < 10) {
+        printf("%s: %d\n", p->local->name, p->local->index++);
+    }
+
+    if (p->local->index >= 10) {
+        DOL_detach(p);
+    }
+
+    return 0;
+}
+