[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua in a threaded enviroment
- From: Daurnimator <quae@...>
- Date: Wed, 31 Aug 2016 20:20:05 +1000
On 31 August 2016 at 20:14, Chris Jones <cmsj@tenshu.net> wrote:
> Hey
>
> Depending on your target platform, and since you can only ever have one
> thread executing Lua at a time, it may be easier to dispatch the work to
> happen on the main thread. We do this in Hammerspoon (OS X) using Apple's
> SDK (things like dispatch_sync(), dispatch_async() and [NSObject
> performSelectorOnMainThread]).
>
> (For the sake of safety, we also perform a sanity check almost every time a
> C function is about to do some Lua work, to make sure it's happening on the
> main thread)
(please bottom post on this list).
You might be interested in this post of mine:
http://daurnimator.com/post/147024385399/using-your-own-main-loop-on-osx
Gives you freedom from libdispatch's built in loop :)