andlabs / andlabs/ui

Tracking issue for macOS threading issues

Aperta
#280 0 commenti 4 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Go
Stelle
8.4k
Fork
639
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

macOS requires all GUI code to be on the first thread created by the OS. The Go runtime moves goroutines between OS threads unless `runtime.LockOSThread()` is called. But there is no formally documented way to ensure that a goroutine is locked to the first OS thread, as opposed to the thread the goroutine happens to be running on at the moment.

Go currently *does* allow this, though: call `runtime.LockOSThread()` from `init()`. Of course, there are catches that I will need to document to be able to do this and make sure it doesn't fail, and Go 1.10's change to make `runtime.LockOSThread()` nested will fix some of them. And the biggest issue is that this isn't really documented yet, meaning I didn't feel comfortable relying on it. Other similar packages (like shiny) did, so...

I've filed an issue on Go asking for this feature to be documented — golang/go#23112. However, fixing this in package ui is not contingent on that issue being closed. package ui documentation *might* be.

The other benefit to this is that we won't need undocumented API calls or mach_override hacks.

You can monitor this issue to see when I have implemented the necessary fixes. IDK if it will require an API change or not.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.