[Top][All Lists]

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

Re: Should this package be included into the NS port?

From: Philipp Stephani
Subject: Re: Should this package be included into the NS port?
Date: Thu, 24 May 2018 19:46:19 +0200

Eli Zaretskii <address@hidden> schrieb am Do., 24. Mai 2018 um 18:38 Uhr:
> Date: Wed, 23 May 2018 22:21:29 +0100
> From: Alan Third <address@hidden>
> Cc: Nick Helm <address@hidden>, address@hidden,
>       address@hidden, address@hidden
> The main problem I have is things coming in the opposite direction. I
> don’t know if W32 is the same, but we can only run GUI related code in
> the main thread.

What do you mean by "GUI code" here?

Code that interacts with the windowing system.

> If we separate the Lisp thread and the NS run loop thread, then code
> called from Lisp can’t directly interact with the NS GUI code, it
> has to be dispatched to the NS run loop thread.

The w32 build has a similar problem, and it solves it by setting up
message queue between the main and the input threads.  Messages are
sent between the two threads when needed, and the Windows native
messages are used in the opposite direction.  So when one thread needs
something done by the other thread, it sends the appropriate message,
waits for a response, then continues (and sometimes it doesn't have to
wait for any response, it depends on the case).

Can NS use some similar machinery?

Most likely yes (because UI toolkits always work that way). The to-be-written GTK+ terminal should use the same mechanism.

See https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html#//apple_ref/doc/uid/10000057i-CH12-123351-BBCFIIEBhttps://developer.apple.com/documentation/appkit/nsapplication/1428710-postevent?language=objc, and https://developer.apple.com/documentation/objectivec/nsobject/1414900-performselectoronmainthread?language=objc.

What's the "input thread" in the Windows implementation? At least on macOS the UI thread (i.e. the thread that creates windows and handles events) must be the main thread, which means the Lisp interpreter thread(s) should become background threads. 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]