lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 8/10/07, John Klimek <jklimek@gmail.com> wrote:
> I'm a little confused because the terms "coroutine" and "thread" are
> used somewhat interchangeably in the Lua documentation.
>
> Are Lua "coroutines" and "threads" the same exact thing?
>
> Thanks...
>

No. Threads are the underlying thing that coroutines are implemented
on top of. Coroutines are threads created in a particular way with a
specific target function, that can be resumed and yielded, but not all
threads are set up this way - if you create a thread via the C api
that has nothing on its stack, that is not (yet) a coroutine.