libgo patch committed: Fix race condition in netchan test

Submitted by Ian Taylor on Jan. 26, 2011, 11:53 p.m.

Details

Message ID mcroc73te6l.fsf@google.com
State New
Headers show

Commit Message

Ian Taylor Jan. 26, 2011, 11:53 p.m.
This patch, copied from the master Go library, avoids a race condition
in the netchan test.  The consequence of the race condition would
normally be a deadlock.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

Patch hide | download patch | download mbox

Index: libgo/go/netchan/netchan_test.go
===================================================================
--- libgo/go/netchan/netchan_test.go	(revision 169248)
+++ libgo/go/netchan/netchan_test.go	(working copy)
@@ -395,7 +395,7 @@  func TestCrossConnect(t *testing.T) {
 		t.Fatal("new importer:", err)
 	}
 
-	go crossExport(e1, e2, t)
+	crossExport(e1, e2, t)
 	crossImport(i1, i2, t)
 }
 
@@ -413,7 +413,7 @@  func crossExport(e1, e2 *Exporter, t *te
 		t.Fatal("exportReceive:", err)
 	}
 
-	crossLoop("export", s, r, t)
+	go crossLoop("export", s, r, t)
 }
 
 // Import side of cross-traffic.