]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: no deadlock error if buildmode=c-archive or c-shared
authorIan Lance Taylor <iant@golang.org>
Sun, 19 Apr 2015 01:19:06 +0000 (18:19 -0700)
committerIan Lance Taylor <iant@golang.org>
Mon, 20 Apr 2015 17:31:44 +0000 (17:31 +0000)
Change-Id: I4ee6dac32bd3759aabdfdc92b235282785fbcca9
Reviewed-on: https://go-review.googlesource.com/9083
Reviewed-by: David Crawshaw <crawshaw@golang.org>
src/runtime/proc1.go

index 2786e7e441f7cb77b52553ff929af6281e2ef007..a46ebc8cec1f763a7f55c53f88d4a843e03b1b2d 100644 (file)
@@ -2711,6 +2711,13 @@ func incidlelocked(v int32) {
 // Check for deadlock situation.
 // The check is based on number of running M's, if 0 -> deadlock.
 func checkdead() {
+       // For -buildmode=c-shared or -buildmode=c-archive it's OK if
+       // there are no running goroutines.  The calling program is
+       // assumed to be running.
+       if islibrary || isarchive {
+               return
+       }
+
        // If we are dying because of a signal caught on an already idle thread,
        // freezetheworld will cause all running threads to block.
        // And runtime will essentially enter into deadlock state,