lua-users home
lua-l archive

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


Does this mean that using large numbers of coroutines (e.g. hundreds concurrently, or hundreds of thousands over a program's lifetime) may be more expensive in luajit 1.x than plain lua?  And if so, is this also likely to be the case in the eagerly anticipated luajit 2.0?

Thanks,

Graham

On Jun 13, 2008, at 4:35 AM, Mike Pall wrote:

Юрий Соколов 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

Be seeing you

grrr waaa
www.grahamwakefield.net