From: Dmitriy Vyukov
-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.