Re: Different behavior for coroutines in Lua and LuaJIT
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Different behavior for coroutines in Lua and LuaJIT
- From: Mike Pall <mikelu-0806@...>
- Date: 2008年6月13日 13:35:47 +0200
Юрий Соколов wrote:
> L1 = lua_newthread(L);
You cannot yield from a thread in LuaJIT 1.x if you don't give it
its own C stack. The standard coroutine.create() and coroutine.wrap()
functions already do this for you. Rewrite your example in pure Lua
code and you'll see it works out-of-the-box.
If you want to create Lua threads from C (not recommended, it's not
faster), you need to read this: http://luajit.org/coco_api.html
Scroll down to lua_newcthread().
--Mike