diff --git a/src/bin/HelloWorldService.hx b/src/bin/HelloWorldService.hx new file mode 100644 index 0000000..cd67c55 --- /dev/null +++ b/src/bin/HelloWorldService.hx @@ -0,0 +1,23 @@ +package bin; + +import kernel.log.Log; +import kernel.Timer; +import kernel.ps.ProcessHandle; +import kernel.ps.Process; + +class HelloWorldService implements Process { + public function new() {} + + public function run(handle:ProcessHandle) { + Log.debug("HelloWorldService started"); + handle.write("Hello World! Started\n"); + this.startTimer(handle); + } + + public function startTimer(handle: ProcessHandle) { + new Timer(1000, function() { + handle.write("Hello World!\n"); + this.startTimer(handle); + }); + } +} \ No newline at end of file diff --git a/src/kernel/binstore/BinStore.hx b/src/kernel/binstore/BinStore.hx index 39e8412..942b5de 100644 --- a/src/kernel/binstore/BinStore.hx +++ b/src/kernel/binstore/BinStore.hx @@ -1,5 +1,6 @@ package kernel.binstore; +import bin.HelloWorldService; import bin.Service; import bin.LSPS; import bin.Turtle; @@ -25,7 +26,8 @@ class BinStore { {c: Terminal, name: "Terminal", aliases: ["terminal","term"]}, {c: Turtle, name: "Turtle", aliases: ["turtle"]}, {c: LSPS, name: "PM", aliases: ["lsps"]}, - {c: Service, name: "Service", aliases: ["service","srv"]} + {c: Service, name: "Service", aliases: ["service","srv"]}, + {c: HelloWorldService, name: "HelloWorldService", aliases: ["hello-service"] } ]; @:allow(kernel.Init)