lostgallifreyan a écrit :
> When I was looking at it I was wondering where and how I'd pass a returned 
> value if I had to, which sort of fits with what you just said. I've never 
> used a co-routine yet, but if I do, is it right to consider it purely as a 
> sub-routine that happens to use a separate thread, and not to concern myself 
> with the underlying methods that make it so?
>   
A coroutine is not a thread, it will not run in parallel of anything 
else. It is similar to a thread because when you call coroutine.yield(), 
it will resume the execution of the main thread, the coroutine is 
paused, its callstack is preserved. Then you can call coroutine.resume( 
yourCoroutine ) to resume the execution of the coroutine just after the 
call to coroutine.yield. For example, if you call coroutine.yield() very 
often, and resume the coroutine from a main loop, this will give a 
parallel-like execution of the main loop and the coroutine.

I'm not sure to understand your question about the return value, but if 
you want to pass a return value from a coroutine to the main thread, you 
can. It is the last coroutine.resume called by the main thread that will 
get the result. You can not get the result at the location where you 
initially started the coroutine however.


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to