[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Should Lua reject (via assertions) calls which may error on a yielded thread?
- From: Patrick Donnelly <batrick@...>
- Date: Wed, 10 Aug 2016 09:48:02 -0400
On Wed, Aug 10, 2016 at 9:22 AM, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>> > I have to rethink that again, but it does seem a good idea to use
>> > non-main threads only inside resumes.
>>
>> I'm not sure I follow what you mean here.
>
> I was just trying to agree with you. Trying again: the only thing that a
> C function should do on a thread that is not its C parameter (the L) is
> to resume it (or xmove values from-to it).
Makes sense. Although I'd add:
o lua_pushthread (followed by lua_xmove) so you can get a Lua value
with only its pointer.
o lua_checkstack (by the way: the manual doesn't say if a yielded
thread has any default space for yield results? [1])
[1] "Whenever Lua calls C, it ensures that the stack has space for at
least LUA_MINSTACK extra slots. LUA_MINSTACK is defined as 20, so that
usually you do not have to worry about stack space unless your code
has loops pushing elements onto the stack."
--
Patrick Donnelly