lua-users home
lua-l archive

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

On Wed, Aug 10, 2016 at 9:22 AM, Roberto Ierusalimschy
<> 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