DarkEspeon, on 19 August 2013 - 08:14 PM, said:
Actually, what parrallel does, is what i believe to be like what a computer does, it alternates between the two extremely quickly, like it gives computations to one for mere milliseconds, then switches and gives the next milliseconds, ect. , with wait for any until one returns, and with waitforall it waits for all to return
Kinda. What coroutines do in Lua is slightly different than what the computer does (in a multiprocessor machine). With coroutines, no matter the system only one will run at a time and the next will not run until the current one has yielded. This is why in CCLua we have the "too long without yielding error". This differs from the (multiprocessor) computers running threads as they are actually able to run multiple threads concurrently.
The main point to take from what I said here is that the coroutine must yield, control is not revoked every millisecond, the routine must yield its control.