]> Cypherpunks repositories - gostls13.git/commit
sync: add more notes about Cond behavior
authorKevin Burke <kevin@burke.dev>
Wed, 15 Jun 2022 04:29:36 +0000 (21:29 -0700)
committerGopher Robot <gobot@golang.org>
Fri, 17 Jun 2022 21:35:36 +0000 (21:35 +0000)
commitd42a48828f3cff4e57cefaf72bc88cef7d355fd6
tree0f16226c057fa8afd4d7aafeecc4ada198222c86
parent9e2f2897546c51863bf860c30622fbe9e3359391
sync: add more notes about Cond behavior

Cond is difficult to use correctly (I was just bitten by it in
a production app that I inherited). While several proposals have come
up to improve or remove sync.Cond, no action has so far been taken.

Update the documentation to discourage use of sync.Cond, and point
people in the direction of preferred alternatives. I believe this will
help encourage behavior we want (less use of sync.Cond and more use of
channels), while also paving the way for, potentially, removing Cond
in a future version of the language.

Thanks very much to Bryan Mills and Sean Liao for discussion and
recommendations.

Updates #20491.
Updates #21165.

Change-Id: Ib4d0631c79d4c4d0a30027255cd43bc47cddebd3
Reviewed-on: https://go-review.googlesource.com/c/go/+/412237
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/sync/cond.go