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

coroutine help?

Started by cmurtheepic, 03 December 2012 - 07:41 PM
cmurtheepic #1
Posted 03 December 2012 - 08:41 PM
could someone please explain to me what a coroutne is i keep hearing about it but i don't know what the heck it is
Tiin57 #2
Posted 04 December 2012 - 05:57 AM
As I understand it, it's just multiple threads being used on a program. That way you can run, say, recent.receive() and a while true do loop at the same time.
Alekso56 #3
Posted 04 December 2012 - 06:11 AM
Coroutines are objects that allow you to form multiple tasks at the same time.

However, only use coroutines when you believe you have no other choice, because many issues can occur with coroutines

HowTo use? please consult the wiki
PixelToast #4
Posted 04 December 2012 - 06:36 AM
coroutines are not multithreading in the sense of running things at the same time
they just halt a segment of code and run it again
the parallel api gives the illusion of multithreading but it just resumes functions in order

see teh manual