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

Multitasking

Started by Niels Henriksen, 18 November 2013 - 02:07 AM
Niels Henriksen #1
Posted 18 November 2013 - 03:07 AM
I need to have a kind of multitasking in a way that the computer will do one task and listen to rednet or wireless.

How can that be done?
TheOddByte #2
Posted 18 November 2013 - 09:33 AM
Well.. This can be easily achieved with os.pullEvent or if you prefeer you can use parallel ;)/>
Btw, could you specify a little more what task you are trying todo? Do you have a code? If so then post it, It always helps all of us to help you.
Edited on 18 November 2013 - 08:34 AM
Zeoic #3
Posted 18 November 2013 - 09:41 AM
Like Hellkid said, the parallel API would be in use here. I just recently used it for a multitasking OS.

The api uses
parallel.waitForAny(function1,function2)
parallel.waitForAll(function1,function2)

This will run two functions at the same time and as the code says, you can make it wait until all of the functions are done or any of them are done to return. But in your case It would be looping a receive function, so you could use either.