lua-users home
lua-l archive

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


On Mon, Aug 12, 2019 at 3:45 PM Andreas Falkenhahn <andreas@falkenhahn.com> wrote:

> To clarify, what I mean by "pause" is that lua_pcall() must return so that control is back on the UI thread. Later, once I have received the event that the message box has been closed, I want to "resume" the previous call to lua_pcall().

Then just make it return. And then call it again. Do not block while in the call.

As I said, the issue is not in Lua, it is in the way you do things. Imagine there is no Lua at all and you just do the whole thing in C - how would you do it?

You probably could make the whole thing fancier in Lua by using co-routines, but, ultimately, the code running in the UI thread - that is to say, the code handling a UI event - must return - or yield - as soon as possible to avoid blocking the UI.

If you need blocking calls, use non-UI threads for them.

All of the above assumes Android cannot have multiple UI threads within one application.

Cheers,
V.