]> Cypherpunks repositories - gostls13.git/commit
runtime: dequeue the correct SudoG
authorKeith Randall <khr@golang.org>
Sun, 19 Oct 2014 04:02:49 +0000 (21:02 -0700)
committerKeith Randall <khr@golang.org>
Sun, 19 Oct 2014 04:02:49 +0000 (21:02 -0700)
commite330cc16f477471c11f78a88c8a71a155a9ca8ec
tree51c2cb1e68d797e654f375d49055e4bbdc381bb4
parent1cd78eedd092c9ec10f1b5c626b8bcd0298e065f
runtime: dequeue the correct SudoG

select {
       case <- c:
       case <- c:
}

In this case, c.recvq lists two SudoGs which have the same G.
So we can't use the G as the key to dequeue the correct SudoG,
as that key is ambiguous.  Dequeueing the wrong SudoG ends up
freeing a SudoG that is still in c.recvq.

The fix is to use the actual SudoG pointer as the key.

LGTM=dvyukov
R=rsc, bradfitz, dvyukov, khr
CC=austin, golang-codereviews
https://golang.org/cl/159040043
src/runtime/chan_test.go
src/runtime/select.go