xopxe / lumen

Lua Multitasking Environment.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`attempt to yield across metamethod/C-call boundary` error

lePereT opened this issue · comments

Hey xopxe

So running this fairly simple code on current master:

local sched = require 'lumen.sched'

local greeter = sched.run(function()
    sched.sleep(1)
end)

local waiter = sched.run(function()
    sched.wait({greeter.EVENT_DIE, greeter.EVENT_FINISH})
end)

sched.loop()

gives this output:

$ lua signaltest.lua 
lua: attempt to yield across metamethod/C-call boundary
stack traceback:
        [C]: in function 'yield'
        /usr/local/lib/lua/5.1/lumen/sched.lua:242: in function 'wait'
        /usr/local/lib/lua/5.1/lumen/sched.lua:85: in function 'walk_waitd'
        /usr/local/lib/lua/5.1/lumen/sched.lua:120: in function 'emit_signal'
        /usr/local/lib/lua/5.1/lumen/sched.lua:134: in function 'check'
        /usr/local/lib/lua/5.1/lumen/sched.lua:149: in function 'step_task'
        /usr/local/lib/lua/5.1/lumen/sched.lua:489: in function 'step'
        /usr/local/lib/lua/5.1/lumen/sched.lua:548: in function 'loop'
        signaltest.lua:11: in main chunk
        [C]: ?
commented

Sorry for the late response. I don't have a 5.1 install right now, and on 5.4 it gives a different error (yielding outside a coroutine). But I think what happened is that the last commit uncovered a bad fix for the same bug.

Could you try switching comments on lines 84 and 85 of sched.lua? It would look like that:

        return --FIXME
        --M.wait()

Hi Xopxe, that works great. So it seems that a FIXME is fixed :)

commented

Cool, committed!