-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
In #85 @akreuzkamp implemented public event loop class.
It doesn't support event loop on secondary threads though as the macOS API we use for that is supposed to be executed only from the main thread:
// (in MacOSPlatformEventLoop::waitForEventsImpl() )
NSEvent *event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:expiration inMode:NSDefaultRunLoopMode dequeue:YES];
And when you do it from another thread, you get an exception:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'nextEventMatchingMask should only be called from the Main Thread!'
It seems that the new API for event loop for macs that can be used for multiple threads is https://developer.apple.com/documentation/corefoundation/cfrunloop?language=objc
Likely we need to use it. What implications does it have wrt window input etc. is beyond me though. Someone with more mac knowledge needs to take a look.
Here's my vibe-coded, ChatGPT-fueled attempt that fails the tests: MiKom@888b601
Maybe it will be useful for some exploration.
Metadata
Metadata
Assignees
Labels
No labels