From 5bf517d5692541dfa1f4fc506c51e0fb7b8a76b4 Mon Sep 17 00:00:00 2001 From: xengineering Date: Thu, 27 May 2021 09:59:37 +0200 Subject: Lock OS Thread later In earlier versions the goroutine was locked to the OS thread very early. This is not needed for e.g. the help page and created confusing log output. --- main.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index e74cd1f..b4d52cf 100644 --- a/main.go +++ b/main.go @@ -8,12 +8,6 @@ import ( "flag" ) -func init() { - // lock this program to one OS thread (details: https://golang.org/pkg/runtime/#LockOSThread) - log.Println("Locking OS thread") - runtime.LockOSThread() -} - func main() { // read command line arguments @@ -27,6 +21,10 @@ func main() { } vertices = stl.toVertices() + // lock this program to one OS thread (details: https://golang.org/pkg/runtime/#LockOSThread) + log.Println("Locking OS thread") + runtime.LockOSThread() + // initialize application (includes GLFW/window) var app App = newApp(&stl) defer app.terminate() // GLFW needs to be terminated! -- cgit v1.2.3-70-g09d2