Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking issue for macOS threading issues #280

Open
andlabs opened this issue Mar 26, 2018 · 0 comments
Open

Tracking issue for macOS threading issues #280

andlabs opened this issue Mar 26, 2018 · 0 comments

Comments

@andlabs
Copy link
Owner

andlabs commented Mar 26, 2018

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.

Repository owner locked and limited conversation to collaborators Mar 26, 2018
Repository owner unlocked this conversation Mar 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant