[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: PATCH: Fully Resumable VM (yield across pcall/callback/meta/iter)
- From: Mark Hamburg <mhamburg@...>
- Date: Wed, 16 Feb 2005 09:10:02 -0800
lua_cpcall can also fail to run the call if it can't build the closure. It
does, however, catch that and report that case rather than exiting. Actual
chances of failure on anything but the smallest system are probably
negligible but if one wants to be paranoid about catching failures it is
useful behavior.
Light C functions would avoid the need for allocating any memory when
pushing the function (assuming space existed on the stack) and hence would
eliminate this danger.
Mark
on 2/16/05 8:47 AM, Mike Pall at mikelu-0502@mike.de wrote:
> Hi,
>
> Mark Hamburg wrote:
>> You removed lua_cpcall on the basis that it was redundant. Note, however,
>> that lua_cpcall catches errors from the case where there is no room to push
>> the function and the light userdata.
>
> Umm, ok. But the only time lua_cpcall is really useful is when you
> use it at the outermost frame and then only for the main thread
> (i.e. only once). This cannot fail because the stack is preallocated
> in lua_open (-> lua_newstate -> f_luaopen) to BASIC_STACK_SIZE (2*20
> elements).