Files
gio-patched/app/internal
Elias Naur 533bf953f9 app/internal/cocoainit: enable multithread support in Cocoa
According to

https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Multithreading/CreatingThreads/CreatingThreads.html#//apple_ref/doc/uid/20000738-125024

Cocoa is by default not multithread-safe for programs that use the posix
api for creating threads:

"
For multithreaded applications, Cocoa frameworks use locks and other
forms of internal synchronization to ensure they behave correctly. To
prevent these locks from degrading performance in the single-threaded
case, however, Cocoa does not create them until the application spawns
its first new thread using the NSThread class. If you spawn threads
using only POSIX thread routines, Cocoa does not receive the
notifications it needs to know that your application is now
multithreaded. When that happens, operations involving the Cocoa
frameworks may destabilize or crash your application.
"

That includes Go programs.

The fix, as discovered by Steeve Morin, is to create and launch
an empty NSThread.

Add a package that does that, and use it everywhere Cocoa is used.

Sigh.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-04-23 21:13:19 +02:00
..
2020-03-15 20:58:30 +01:00
2020-04-01 13:04:40 +02:00
2020-04-01 13:04:40 +02:00