summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <mail2xengineering@protonmail.com>2021-05-27 09:59:37 +0200
committerxengineering <mail2xengineering@protonmail.com>2021-05-27 09:59:37 +0200
commit5bf517d5692541dfa1f4fc506c51e0fb7b8a76b4 (patch)
treeac5855d61208863e5ac6a90df5381f62f16df6b1
parentb37c8b22a954f52c280722a6f9ff41cbc8ecf8d3 (diff)
downloadstlscope-5bf517d5692541dfa1f4fc506c51e0fb7b8a76b4.tar
stlscope-5bf517d5692541dfa1f4fc506c51e0fb7b8a76b4.tar.zst
stlscope-5bf517d5692541dfa1f4fc506c51e0fb7b8a76b4.zip
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.
-rw-r--r--main.go10
1 files 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!