The main diffrenece between coroutines and threads is that threads are meant to run in "paralel" (and they *really* do on multiprocessor machines), while coroutines are not. Therefore, when using coroutines, there is no need to worry about synchronisation, race conditions, starvation, you know ... stuff that plagues "multithreaded programming".
For an excelent discussion of coroutines and how they work in Lua, see this paper:
http://www.inf.puc-rio.br/~roberto/docs/corosblp.pdf
In reply to Re: Re: Coroutines in Perl
by mrd
in thread Coroutines in Perl
by leriksen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |