Async or event library

rikki cattermole via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 6 05:51:07 PDT 2016


On 07/05/2016 12:08 AM, chmike wrote:
> Excuse the naive question rikki, why does the window event loop have to
> be single threaded ? The question is just to expose the rationale.
>
> Is it to avoid the synchronization overhead to access the window data ?
> In this case there is indeed a lot of data. Is there another reason ?
>
> In some applications and event types the synchronization overhead is
> small compared to the benefit of executing tasks in parallel on
> different cores.
>
> It is indeed none trivial and could be an interresting phd study subject.

The window event loop doesn't have to be single threaded, but it is 
thread limited. Specifically it cannot be on other threads. If you 
attempt to work with another threads window, it is more or less 
undefined behavior across the board.

Even with Cocoa (OSX's way for GUI's) is considered thread-unsafe 
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html
And that is far higher level then X11 or WinAPI does it.


More information about the Digitalmars-d-learn mailing list