]> pd.if.org Git - mmurtl/commitdiff
autocommit for file dated 1995-02-09 15:58:06
authorRichard Burgess <>
Thu, 9 Feb 1995 15:58:06 +0000 (15:58 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Mon, 17 Oct 2016 14:03:48 +0000 (14:03 +0000)
msamples/busyloop/busyloop.c [new file with mode: 0644]

diff --git a/msamples/busyloop/busyloop.c b/msamples/busyloop/busyloop.c
new file mode 100644 (file)
index 0000000..71e2024
--- /dev/null
@@ -0,0 +1,33 @@
+/* Busy loop demonstrates the preemptive capabilites of MMURTL.\r
+   It doesn't go through the kernel and never sleeps. It is\r
+   a task that is ALWAYS ready to run.\r
+\r
+   It runs at the default priority of 25, and rest assured,\r
+   other higher priority tasks will receive messages and be\r
+   queued to run.\r
+\r
+   If you run it, you will have to use the CTRL-ALT-DELETE keys\r
+   to kill it.\r
+   To build, use MakeIt.bat, or use CM32 or DASM separately:\r
+   CM32 BusyLoop.c\r
+   DASM BusyLoop.atf\r
+*/\r
+\r
+#include <stdio.h>\r
+#include "\OSSource\Mtimer.h"\r
+#include "\OSSource\MJob.h"\r
+\r
+unsigned long tick;\r
+\r
+void main(void)\r
+{\r
+long i;\r
+       SetJobName("BusyLoop", 8);\r
+       Sleep(100); /* A small delay before we start eating CPU time */\r
+       while (1) \r
+       {\r
+               GetTimerTick(&tick);\r
+           printf("%d \r\n", tick);\r
+               i++;\r
+       }\r
+}\r