Skip to content

Commit 6782076

Browse files
authored
Merge pull request #5036 from trodemaster/fix/darwin-lock-main-thread
fix(darwin): pin main goroutine to OS thread 0 for VZ GUI
2 parents f52b7b9 + 8a80d55 commit 6782076

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

cmd/limactl/main_darwin_gui.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//go:build darwin
2+
3+
// SPDX-FileCopyrightText: Copyright The Lima Authors
4+
// SPDX-License-Identifier: Apache-2.0
5+
6+
package main
7+
8+
import "runtime"
9+
10+
func init() {
11+
// Lock the main goroutine to the initial process thread before main() runs.
12+
// VZVirtualMachineView requires GUI operations on the initial thread; without
13+
// this, Go's scheduler may migrate the goroutine before hostagent starts.
14+
// Assumes no other package init() triggers a scheduling point before this runs.
15+
runtime.LockOSThread()
16+
}

0 commit comments

Comments
 (0)