libgo patch committed: Fix race condition in netchan test

Message ID
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.



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.