andlabs / andlabs/ui

Tracking issue for macOS threading issues

Ouverte
#280 0 commentaires 4 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Go
Étoiles
8.4k
Forks
639
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.