aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/runtime/sema.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/runtime/sema.go')
-rw-r--r--libgo/go/runtime/sema.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/libgo/go/runtime/sema.go b/libgo/go/runtime/sema.go
index d04e6f5..6e2beec 100644
--- a/libgo/go/runtime/sema.go
+++ b/libgo/go/runtime/sema.go
@@ -275,7 +275,10 @@ func (root *semaRoot) queue(addr *uint32, s *sudog, lifo bool) {
// on the ticket: s.ticket <= both s.prev.ticket and s.next.ticket.
// https://en.wikipedia.org/wiki/Treap
// http://faculty.washington.edu/aragon/pubs/rst89.pdf
- s.ticket = fastrand()
+ //
+ // s.ticket compared with zero in couple of places, therefore set lowest bit.
+ // It will not affect treap's quality noticeably.
+ s.ticket = fastrand() | 1
s.parent = last
*pt = s