]> Cypherpunks repositories - gostls13.git/commit
runtime: fix accounting race in printlock
authorRuss Cox <rsc@golang.org>
Wed, 14 Jan 2015 19:57:10 +0000 (14:57 -0500)
committerRuss Cox <rsc@golang.org>
Wed, 14 Jan 2015 20:28:08 +0000 (20:28 +0000)
commitbfeda9188a054efdb950c9c9727d6bce7ad04961
tree6fb4a978404ca3618e5e473d428d63c016c0a726
parent3be0a0ef6fb80d099aefdba67b68df3b500188bc
runtime: fix accounting race in printlock

It could happen that mp.printlock++ happens, then on entry to lock,
the goroutine is preempted and then rescheduled onto another m
for the actual call to lock. Now the lock and the printlock++ have
happened on different m's. This can lead to printlock not being
unlocked, which either gives a printing deadlock or a crash when
the goroutine reschedules, because m.locks > 0.

Change-Id: Ib0c08740e1b53de3a93f7ebf9b05f3dceff48b9f
Reviewed-on: https://go-review.googlesource.com/2819
Reviewed-by: Rick Hudson <rlh@golang.org>
src/runtime/print1.go