lua-users home
lua-l archive

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

> *Solution:
> *
> Maintain a count in each state representing the 'depth' of coroutine
> resumptions (nresumes) which are active at that moment, and use the sum
> of resumes and C calls for stack depth tests. This is incremented and
> tested before the nested luaV_execute, and then decremented after it.
> The value is propagated from state to state at the same time execution
> moves into the coroutine's thread.
> >
> [...]
> > > The author would appreciate any feedback you can provide.

I have two concerns about this patch:

1) I am not very comfortable with the use of lua_xmove to pass the depth
from one coroutine to the next. It looks like a trick that may have
unintended consequences.

2) I am not sure it really solves the bug. It seems that if each
coroutine calls the next inside a deep nest of pcalls (or something
similar that consumes C stack), the code will count only 1 for each
coroutine nesting, so that the C stack may overflow before the counting
reaches its limit.

I still prefer the idea of moving nCcalls from lua_State into

-- Roberto