From 5254c5188ee0859797ee7432223a5c26a2a29288 Mon Sep 17 00:00:00 2001 From: Derek Parker Date: Sun, 23 Nov 2014 10:22:04 -0600 Subject: [PATCH] Move LockOSThread into init --- cmd/dlv/main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/dlv/main.go b/cmd/dlv/main.go index 5a785632..cebe98ae 100644 --- a/cmd/dlv/main.go +++ b/cmd/dlv/main.go @@ -25,12 +25,14 @@ type term struct { const historyFile string = ".dbg_history" -func main() { +func init() { // We must ensure here that we are running on the same thread during // the execution of dbg. This is due to the fact that ptrace(2) expects // all commands after PTRACE_ATTACH to come from the same thread. runtime.LockOSThread() +} +func main() { var ( pid int run bool