This is the mail archive of the gcc-cvs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

r249565 - in /trunk: gcc/go/gofrontend/MERGE li...


Author: ian
Date: Thu Jun 22 15:46:47 2017
New Revision: 249565

URL: https://gcc.gnu.org/viewcvs?rev=249565&root=gcc&view=rev
Log:
    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

Modified:
    trunk/gcc/go/gofrontend/MERGE
    trunk/libgo/go/runtime/debug.go
    trunk/libgo/go/runtime/mfinal.go
    trunk/libgo/go/runtime/mgc.go
    trunk/libgo/go/runtime/proc.go
    trunk/libgo/go/runtime/time.go


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]