From 6808da0163a353f7c4d871a215417e0da4db71f8 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 27 Oct 2011 18:04:12 -0700 Subject: runtime: lock the main goroutine to the main OS thread during init We only guarantee that the main goroutine runs on the main OS thread for initialization. Programs that wish to preserve that property for main.main can call runtime.LockOSThread. This is what programs used to do before we unleashed goroutines during init, so it is both a simple fix and keeps existing programs working. R=iant, r, dave, dvyukov CC=golang-dev https://golang.org/cl/5309070 --- src/pkg/runtime/debug.go | 1 - 1 file changed, 1 deletion(-) (limited to 'src/pkg/runtime/debug.go') diff --git a/src/pkg/runtime/debug.go b/src/pkg/runtime/debug.go index 6370a57d80..124370384c 100644 --- a/src/pkg/runtime/debug.go +++ b/src/pkg/runtime/debug.go @@ -10,7 +10,6 @@ func Breakpoint() // LockOSThread wires the calling goroutine to its current operating system thread. // Until the calling goroutine exits or calls UnlockOSThread, it will always // execute in that thread, and no other goroutine can. -// LockOSThread cannot be used during init functions. func LockOSThread() // UnlockOSThread unwires the calling goroutine from its fixed operating system thread. -- cgit v1.3-5-g9baa