]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: document that LockOSThread in init locks to thread
authorIan Lance Taylor <iant@golang.org>
Thu, 29 Mar 2018 18:26:27 +0000 (11:26 -0700)
committerIan Lance Taylor <iant@golang.org>
Fri, 13 Apr 2018 03:15:02 +0000 (03:15 +0000)
This is more or less implied by the spec language on initialization,
but restate it for clarity.

Fixes #23112

Change-Id: Ibe5385acafe4eac38823de98a025cd37f7a77d3b
Reviewed-on: https://go-review.googlesource.com/103399
Reviewed-by: Austin Clements <austin@google.com>
src/runtime/proc.go

index 98d78f0c82b733d5bdc82c9fafd6d6606c83beb3..a4a93e7878e78c462c6cf9836b65a5a371e7fb61 100644 (file)
@@ -3472,6 +3472,10 @@ func dolockOSThread() {
 // If the calling goroutine exits without unlocking the thread,
 // the thread will be terminated.
 //
+// All init functions are run on the startup thread. Calling LockOSThread
+// from an init function will cause the main function to be invoked on
+// that thread.
+//
 // A goroutine should call LockOSThread before calling OS services or
 // non-Go library functions that depend on per-thread state.
 func LockOSThread() {