From f58ed4e64126b595efbde9df04e63c7ea2a4fbd6 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 13 Oct 2011 16:58:04 -0400 Subject: gc: disallow close on receive-only channels Fixes #2353. Fixes #2246. R=golang-dev, r, gri CC=golang-dev https://golang.org/cl/5282042 --- src/pkg/runtime/chan.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/pkg') diff --git a/src/pkg/runtime/chan.c b/src/pkg/runtime/chan.c index cc056f65f1..475da233c1 100644 --- a/src/pkg/runtime/chan.c +++ b/src/pkg/runtime/chan.c @@ -1052,6 +1052,9 @@ runtime·closechan(Hchan *c) SudoG *sg; G* gp; + if(c == nil) + runtime·panicstring("close of nil channel"); + if(runtime·gcwaiting) runtime·gosched(); -- cgit v1.3-5-g9baa