From cd49efa84e081c1fa77d90b058135af2f29926cc Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 31 Mar 2016 21:10:12 +0200 Subject: [PATCH] Enable Cocoa multi-threaded mode --- src/cocoa_window.m | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index f5e99289..13752053 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -763,6 +763,12 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; [super sendEvent:event]; } + +// No-op thread entry point +// +- (void)doNothing:(id)object +{ +} @end #if defined(_GLFW_USE_MENUBAR) @@ -888,6 +894,11 @@ static GLFWbool initializeAppKit(void) // Implicitly create shared NSApplication instance [GLFWApplication sharedApplication]; + // Make Cocoa enter multi-threaded mode + [NSThread detachNewThreadSelector:@selector(doNothing:) + toTarget:NSApp + withObject:nil]; + // In case we are unbundled, make us a proper UI application [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];