lua-users home
lua-l archive

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


On Thu, 29 Sep 2011, Tim Mensch wrote:

On 9/29/2011 6:50 PM, HyperHacker wrote:
> The message is correct; in Lua 5.1 a coroutine can't yield across a
> C function call. 5.2 allows this.

Sorry, but LuaCoco changes this behavior. [1] Note that ANY function under LuaJIT 1.x can become a "C function", and so yield()
wouldn't work from within a compiled Lua function if what you're saying is true. Yet it does.

LuaCoco should let you yield across a C boundary, since it creates a C stack for each coroutine.

What do you see when you run:
  print(coroutine.coco)
?

If it's true, then it should work, as far as I know. That's how lua_yield() is changed by LuaCoco. If it's nil, then you're not
using LuaCoco, which would explain the issue.

Yes I am using LuaCoco but not LuaJIT. It's Lua 5.1.4 with the LuaCoco patch. I'm not sure my implementation is correct since I'm getting the 'C-boundary' errors. That's why I'm asking the list.

mitchell