lua-users home
lua-l archive

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

* Sam Roberts:

> On Sat, Dec 6, 2008 at 10:46 PM, Florian Weimer <> wrote:
>> * Sam Roberts:
>> It's difficult to reproduce this with the expat binding because it's
>> not expected to be reentrant (it just crashes).  If there was a second
>> function like parse, I could use the same trick, I think.
>> Here's the crasher for the LuaExpat binding (the one at
>> <>, I hope it's related to the
>> one in PIL):
> This is unrelated to the sqlite bug you found. expat itself is
> non-reentrant. I suspect you could reproduce this crash in pure C by
> calling expat's parse from a callback that parse is calling.

Sure, but that's the reason why I can reproduce the original
issue. 8-)

In this sense, the example in PIL is incomplete.

> When C is called from lua, it must use the L it was passed. If C calls
> back into lua, after lua returns to it, it must use the L it was
> originally passed. Still. Even if lua had called back into C. This may
> not be easy to arrange, and until coroutines are used creatively, bugs
> may never be seen.
> What was the question?

I wonder if there's a canonical way to avoid these problems, perhaps
involving lua_newthread.