aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/runtime')
-rw-r--r--src/pkg/runtime/proc.c8
-rw-r--r--src/pkg/runtime/proc_test.go30
2 files changed, 8 insertions, 30 deletions
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c
index 5c60cddf9b..f8ddf9b47e 100644
--- a/src/pkg/runtime/proc.c
+++ b/src/pkg/runtime/proc.c
@@ -397,6 +397,14 @@ canaddmcpu(void)
static void
gput(G *gp)
{
+ M *mp;
+
+ // If g is wired, hand it off directly.
+ if((mp = gp->lockedm) != nil && canaddmcpu()) {
+ mnextg(mp, gp);
+ return;
+ }
+
// If g is the idle goroutine for an m, hand it off.
if(gp->idlem != nil) {
if(gp->idlem->idleg != nil) {
diff --git a/src/pkg/runtime/proc_test.go b/src/pkg/runtime/proc_test.go
index b68599a496..927bd7b816 100644
--- a/src/pkg/runtime/proc_test.go
+++ b/src/pkg/runtime/proc_test.go
@@ -46,36 +46,6 @@ func TestStopTheWorldDeadlock(t *testing.T) {
runtime.GOMAXPROCS(maxprocs)
}
-func TestYieldProgress(t *testing.T) {
- testYieldProgress(t, false)
-}
-
-func TestYieldLockedProgress(t *testing.T) {
- testYieldProgress(t, true)
-}
-
-func testYieldProgress(t *testing.T, locked bool) {
- c := make(chan bool)
- cack := make(chan bool)
- go func() {
- if locked {
- runtime.LockOSThread()
- }
- for {
- select {
- case <-c:
- cack <- true
- break
- default:
- runtime.Gosched()
- }
- }
- }()
- time.Sleep(10 * time.Millisecond)
- c <- true
- <-cack
-}
-
func TestYieldLocked(t *testing.T) {
const N = 10
c := make(chan bool)