]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: don't terminate locked OS threads on Plan 9
authorDavid du Colombier <0intro@gmail.com>
Mon, 16 Oct 2017 22:31:56 +0000 (00:31 +0200)
committerDavid du Colombier <0intro@gmail.com>
Tue, 17 Oct 2017 15:15:12 +0000 (15:15 +0000)
CL 46037 and CL 46038 implemented termination of
locked OS threads when the goroutine exits.

However, this behavior leads to crashes of Go programs
using runtime.LockOSThread on Plan 9. This is notably
the case of the os/exec and net packages.

This change disables termination of locked OS threads
on Plan 9.

Updates #22227.

Change-Id: If9fa241bff1c0b68e7e9e321e06e5203b3923212
Reviewed-on: https://go-review.googlesource.com/71230
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/runtime/proc.go

index 4133b2358490b0187bfff0e17e4726c1c9b5a6a4..48ce7d62488df954499aa7019f72fd401a22b54d 100644 (file)
@@ -2671,7 +2671,9 @@ func goexit0(gp *g) {
 
                // Return to mstart, which will release the P and exit
                // the thread.
-               gogo(&_g_.m.g0.sched)
+               if GOOS != "plan9" { // See golang.org/issue/22227.
+                       gogo(&_g_.m.g0.sched)
+               }
        }
        schedule()
 }