commit | fd80eb99c8f653c847d294a001bdf2a3a6f768f5 | [log] [tgz] |
---|---|---|
author | Bryan C. Mills <bcmills@google.com> | Wed Nov 01 15:49:15 2017 -0400 |
committer | Bryan Mills <bcmills@google.com> | Wed Nov 01 21:47:15 2017 +0000 |
tree | c8c31ae6a61f1327cdaa14f00685fb9708454466 | |
parent | 8e0aa688b654ef28caa72506fa5ec8dba9fc7690 [diff] |
semaphore: add worker-pool example I've commented several times in various forums that basically every time I've seen the “worker goroutine” pattern in Go, there has turned out to be a cleaner implementation using semaphores. This change adds a simple such example. (For more complex usage, I would generally pair the semaphore with an errgroup.Group.) Change-Id: Ibf69ee761d14ba59c1acc6a2d595b4fcf0d8f6d6 Reviewed-on: https://go-review.googlesource.com/75170 Reviewed-by: Ross Light <light@google.com>
This repository provides Go concurrency primitives in addition to the ones provided by the language and “sync” and “sync/atomic” packages.
The easiest way to install is to run go get -u golang.org/x/sync
. You can also manually git clone the repository to $GOPATH/src/golang.org/x/sync
.
This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html.
The main issue tracker for the sync repository is located at https://github.com/golang/go/issues. Prefix your issue with “x/sync:” in the subject line, so it is easy to find.