]> Cypherpunks repositories - gostls13.git/commit
runtime: define lock order between G status and channel lock
authorAustin Clements <austin@google.com>
Sun, 21 Feb 2016 15:40:39 +0000 (10:40 -0500)
committerAustin Clements <austin@google.com>
Wed, 16 Mar 2016 20:13:17 +0000 (20:13 +0000)
commitd45bf7228f742e63a30eef03e5288df332906838
treedd1f2176d04bd888407444e14ce4dc96a0e05b4c
parentdb72b41bcd67ecb80890d586effbabd8d110952c
runtime: define lock order between G status and channel lock

Currently, locking a G's stack by setting its status to _Gcopystack or
_Gscan is unordered with respect to channel locks. However, when we
make stack shrinking concurrent, stack shrinking will need to lock the
G and then acquire channel locks, which imposes an order on these.

Document this lock ordering and fix closechan to respect it.
Everything else already happens to respect it.

For #12967.

Change-Id: I4dd02675efffb3e7daa5285cf75bf24f987d90d4
Reviewed-on: https://go-review.googlesource.com/20041
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/runtime/chan.go