This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
cheetah's profile picture

Coroutines - Making A Daemon

Started by cheetah, 04 August 2013 - 12:40 AM
cheetah #1
Posted 04 August 2013 - 02:40 AM
While making my first OS i've encountered an obstacle.
One of most important part of my system is a router - a program which can break the barrier of 384m wireless range.
But I want to use as a router every computer which is using my OS.

So, tl;dr: i need something alike linux daemon - while the normal shell is running in foreground, my router is redirecting connections in background. How i can do this?
LBPHacker #2
Posted 04 August 2013 - 04:07 AM
The best you can do without rewriting the BIOS is exiting the top-level shell (there is a tutorial on that) (but that still leaves the rednet coroutine running). From that on you can use your own coroutine management system - which, I suppose, will start a new shell as well - and your routing daemon. About the coroutine part; there is also a tutorial on that.
Lyqyd #3
Posted 04 August 2013 - 05:01 AM
I don't believe that the top level coroutine override leaves the rednet coroutine running. All he would need to do is put a parallel.waitForAny in his startup files starting his coroutine and a shell session.