diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-06-22 15:46:47 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-06-22 15:46:47 +0000 |
commit | 47f68dc2318a708b375768a09ae42833109e0bce (patch) | |
tree | 6a99bb0ecaa8b80fff1f3d04929533bbc7d22048 /gcc | |
parent | b8f70831bfbd1e9bdd989010ea114967bee0f34b (diff) | |
download | gcc-47f68dc2318a708b375768a09ae42833109e0bce.zip gcc-47f68dc2318a708b375768a09ae42833109e0bce.tar.gz gcc-47f68dc2318a708b375768a09ae42833109e0bce.tar.bz2 |
runtime: make NumGoroutine wait for system goroutines to register
In libgo system goroutines register themselves after they start.
That means that there is a small race between the goroutine being
seen by the scheduler and the scheduler knowing that the goroutine
is a system goroutine. That in turn means that runtime.NumGoroutines
can overestimate the number of goroutines at times.
This patch fixes the overestimate by counting the number of system
goroutines waiting to start, and pausing NumGoroutines until those
goroutines have all registered.
This is kind of a lot of mechanism for this not very important
problem, but I couldn't think of a better approach.
The test for this is TestNumGoroutine in runtime/proc_test.go.
The test is not currently run, but it will be soon.
Reviewed-on: https://go-review.googlesource.com/46457
From-SVN: r249565
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index dbff708..ccc7919 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -54d83c2d67c35ad4f622936d2fbf81c17354fff9 +681c8a7b0a9d52c0b81e7a4b1c55fe65ed889573 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. |