Skip to content

Commit

Permalink
Merge pull request #887 from gucio321/lockosthread-windows
Browse files Browse the repository at this point in the history
mainthread: lock main os threa on Windows
  • Loading branch information
gucio321 authored Oct 20, 2024
2 parents f64eda1 + 7b1a6aa commit c4e585a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions mainthread_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,21 @@

package giu

// TODO: I have no working mainthread library for windows.
import "runtime"

// according to:
// https://github.com/AllenDang/giu/issues/881
// this init solves some windows problems.
// However I'm not sure about implications of this. Will turn out later.
func init() {
runtime.LockOSThread()
}

// I have no working mainthread library for windows.
// - this one for macOS crashes app immediately
// - this for linux (and everything else) freezes after a few seconds
//
// With no mianthread support this at least runs sometimes. Just keep your giu calls in one thread and everything should work.
//
// this seems to solve an issue: https://github.com/AllenDang/giu/issues/881
func mainthreadCallPlatform(c func()) {
c()
}

0 comments on commit c4e585a

Please sign in to comment.