From: Dmitriy Vyukov Date: Thu, 5 Jun 2014 17:08:28 +0000 (+0400) Subject: doc: fix happens-before rules for buffered channels X-Git-Tag: go1.4beta1~1331 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=81a93ef24a502f74f542845b3a35f22a573f6876;p=gostls13.git doc: fix happens-before rules for buffered channels The current wording is reversed in 2 places. Not sure how it got 4 LGTMs (mine was there as well). Update #6242. LGTM=dan.kortschak, r, rsc R=golang-codereviews, 0xjnml, dan.kortschak, r, rsc CC=golang-codereviews https://golang.org/cl/101980047 --- diff --git a/doc/go_mem.html b/doc/go_mem.html index 69e7c8ce75..2ea1ded7a3 100644 --- a/doc/go_mem.html +++ b/doc/go_mem.html @@ -1,6 +1,6 @@ @@ -275,17 +275,17 @@ crash, or do something else.)

-The kth send on a channel with capacity C happens before the k+Cth receive from that channel completes. +The kth receive on a channel with capacity C happens before the k+Cth send from that channel completes.

This rule generalizes the previous rule to buffered channels. It allows a counting semaphore to be modeled by a buffered channel: -the number of items in the channel corresponds to the semaphore count, -the capacity of the channel corresponds to the semaphore maximum, +the number of items in the channel corresponds to the number of active uses, +the capacity of the channel corresponds to the maximum number of simultaneous uses, sending an item acquires the semaphore, and receiving an item releases the semaphore. -This is a common idiom for rate-limiting work. +This is a common idiom for limiting concurrency.