lua-users home
lua-l archive

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




On Feb 19, 2020, at 9:25 PM, Eric Wing <ewmailing@gmail.com> wrote:

On 2/19/20, Coda Highland <chighland@gmail.com> wrote:
On Wed, Feb 19, 2020 at 1:16 PM Eric Wing <ewmailing@gmail.com> wrote:

Manually pumping the event loop on macOS can work in limited cases,
but can/will break down if your application uses/interacts other
system frameworks that depend on the native event loop. Apple has
private implementation details in their event loop pump which can't be
recreated through public APIs and some of their own implementations
seem to depend on these things (or have some kind of implicit
assumptions). For example, things with modal windows, file dialogs,
and menu bar interaction may no longer work correctly. I remember a
very old bug where Game Center just wouldn't work.


I'm well aware of that fact, but... who's suggesting doing that? Queueing
up continuations on the event loop is a far better way of going about it.


The op's proposed code using NSApp nextEventMatchingMask is manually
pumping the event loop.

Looking deeper coroutines as a possible alternative, I discovered that they are currently fundamentally broken in Hammerspoon, so working on fixing that little snafu atm... one crisis at a time, please :-)

--
Aaron