Skip to content

Commit eb4f332

Browse files
runtime: document that LockOSThread in init locks to thread
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 <[email protected]>
1 parent 2d4ccbf commit eb4f332

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/runtime/proc.go

+4
Original file line numberDiff line numberDiff line change
@@ -3472,6 +3472,10 @@ func dolockOSThread() {
34723472
// If the calling goroutine exits without unlocking the thread,
34733473
// the thread will be terminated.
34743474
//
3475+
// All init functions are run on the startup thread. Calling LockOSThread
3476+
// from an init function will cause the main function to be invoked on
3477+
// that thread.
3478+
//
34753479
// A goroutine should call LockOSThread before calling OS services or
34763480
// non-Go library functions that depend on per-thread state.
34773481
func LockOSThread() {

0 commit comments

Comments
 (0)