From 85d5b5771d8a3f777b44ae1833b8c580cae03b98 Mon Sep 17 00:00:00 2001 From: badkaktus Date: Mon, 7 Oct 2019 22:03:06 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B1=D1=83=D1=84=D0=B5=D1=80=D0=B8=D0=B7?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=BD=D1=8B=D0=B9=20=D0=BA?= =?UTF-8?q?=D0=B0=D0=BD=D0=B0=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples.txt | 2 +- .../channel-buffering/channel-buffering.go | 24 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples.txt b/examples.txt index 4420f34..ac5dcde 100644 --- a/examples.txt +++ b/examples.txt @@ -21,7 +21,7 @@ Switch Ошибки (Errors) Горутины (Goroutines) Каналы (Channels) -Channel Buffering +Буферизированный канал (Channel Buffering) Channel Synchronization Channel Directions Select diff --git a/examples/channel-buffering/channel-buffering.go b/examples/channel-buffering/channel-buffering.go index d2e8d8f..fd757ed 100644 --- a/examples/channel-buffering/channel-buffering.go +++ b/examples/channel-buffering/channel-buffering.go @@ -1,9 +1,9 @@ -// By default channels are _unbuffered_, meaning that they -// will only accept sends (`chan <-`) if there is a -// corresponding receive (`<- chan`) ready to receive the -// sent value. _Buffered channels_ accept a limited -// number of values without a corresponding receiver for -// those values. +// По умолчанию каналы _не буферизованы_, это означает, +// что они будут принимать отправления (`chan <-`), только +// если есть соответствующий прием (`<- chan`), готовый +// принять отправленное значение. _Буферизованные каналы_ +// принимают ограниченное количество значений без +// соответствующего приемника для этих значений. package main @@ -11,17 +11,17 @@ import "fmt" func main() { - // Here we `make` a channel of strings buffering up to - // 2 values. + // Здесь мы `создаем` канал строк с буфером до 2 + // значений. messages := make(chan string, 2) - // Because this channel is buffered, we can send these - // values into the channel without a corresponding - // concurrent receive. + // Т.к. этот канал буферизирован, мы можем послать + // значения в канал без соответствующего одновременного + // получения. messages <- "buffered" messages <- "channel" - // Later we can receive these two values as usual. + // Позже мы можем получить эти значения как обычно. fmt.Println(<-messages) fmt.Println(<-messages) }