lua-users home
lua-l archive

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


>>>>> "Soni" == Soni \"They/Them\" L <fakedme@gmail.com> writes:

 >> I'm not sure that helps. It certainly presents a problem of how to
 >> unwind the C stack safely, especially in the case where Lua code has
 >> called a C function that calls a Lua callback.

 Soni> where you'd use pcall/error you use coroutine.create+pcallk/yield
 Soni> instead. when it yields, throw it away, and you never(?) run the
 Soni> toclose that way.

But even that is a whole lot of extra bookkeeping - for example I would
then have to know, for each thread, whether it is inside a pcall()
(since in that case I really do still need to throw the error). It would
probably (I haven't worked it all out) also mean either disabling access
to coroutine.create from the Lua code, or wrapping it in order to keep
track of new threads.

-- 
Andrew.