Commit ec767c10 authored by Keith Randall's avatar Keith Randall

runtime: add comment about channels already handling zero-sized objects correctly.

update #9401

Change-Id: I634a772814e7cd066f631a68342e7c3dc9d27e72
Reviewed-on: https://go-review.googlesource.com/2370Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
parent 5aae246f
......@@ -46,7 +46,9 @@ func makechan(t *chantype, size int64) *hchan {
if size > 0 && elem.size != 0 {
c.buf = (*uint8)(add(unsafe.Pointer(c), hchanSize))
} else {
c.buf = (*uint8)(unsafe.Pointer(c)) // race detector uses this location for synchronization
// race detector uses this location for synchronization
// Also prevents us from pointing beyond the allocation (see issue 9401).
c.buf = (*uint8)(unsafe.Pointer(c))
}
} else {
c = new(hchan)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment