]> Cypherpunks repositories - gostls13.git/commit
runtime: fix using fastrand in sema.go
authorSokolov Yura <funny.falcon@gmail.com>
Wed, 4 Oct 2017 11:35:33 +0000 (14:35 +0300)
committerAustin Clements <austin@google.com>
Wed, 4 Oct 2017 18:41:11 +0000 (18:41 +0000)
commit9d9722a2e16fa3f31dc336f4b12ef4d45e770e66
treeeff3f51a1ea7356bc42debc1f40361f768d138bc
parentdbb13eff8eab8b1094d6b63447cf6be7d259570d
runtime: fix using fastrand in sema.go

Before CL 62530 fastrand always returned non-zero value, and one
condition in sema.go depends on this behavior.

fastrand is used to generate random weight for treap of sudog, and
it is checked against zero to verify sudog were inserted into treap or
wait queue.

Since its precision is not very important for correctness, lets just
always set its lowest bit in this place.

Updates #22047
Updates #21806

Change-Id: Iba0b56d81054e6ef9c49ffd293fc5d92a6a31e9b
Reviewed-on: https://go-review.googlesource.com/68050
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/runtime/sema.go