Rename waitgroup-->waitgroups
This commit is contained in:
parent
074571d952
commit
ec0b192e48
@ -32,7 +32,7 @@ Range over Channels
|
||||
Timers
|
||||
Tickers
|
||||
Worker Pools
|
||||
WaitGroup
|
||||
WaitGroups
|
||||
Rate Limiting
|
||||
Atomic Counters
|
||||
Mutexes
|
||||
|
@ -2,7 +2,7 @@
|
||||
// across goroutines. Here's an example of using a
|
||||
// blocking receive to wait for a goroutine to finish.
|
||||
// When waiting for multiple goroutines to finish,
|
||||
// you may prefer to use a [WaitGroup](waiting-for-goroutines-to-finish).
|
||||
// you may prefer to use a [WaitGroup](waitgroups).
|
||||
|
||||
package main
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
df90432a53832c045472981a9da23d1139fb2b5c
|
||||
f6qTtt1agmN
|
||||
eb022977181884c2ab0f2b69e50311769e67a509
|
||||
8lmP8beav0p
|
||||
|
@ -1,2 +0,0 @@
|
||||
ffc6520e73ebfa2b8c470e3ef00fee55388234e0
|
||||
8cD2V9CgI0J
|
2
examples/waitgroups/waitgroups.hash
Normal file
2
examples/waitgroups/waitgroups.hash
Normal file
@ -0,0 +1,2 @@
|
||||
499c7ee59b2ae06d2d3171768d9cf11762121a87
|
||||
gLLmgcR7YkP
|
@ -1,4 +1,4 @@
|
||||
$ go run waitgroup.go
|
||||
$ go run waitgroups.go
|
||||
Worker 5 starting
|
||||
Worker 3 starting
|
||||
Worker 4 starting
|
@ -44,7 +44,7 @@ func main() {
|
||||
// Finally we collect all the results of the work.
|
||||
// This also ensures that the worker goroutines have
|
||||
// finished. An alternative way to wait for multiple
|
||||
// goroutines is to use a [WaitGroup](waitgroup).
|
||||
// goroutines is to use a [WaitGroup](waitgroups).
|
||||
for a := 1; a <= 5; a++ {
|
||||
<-results
|
||||
}
|
||||
|
@ -1,2 +1,2 @@
|
||||
3f7712d470dcbfc0cdddc939bb80814baaff8bb0
|
||||
Q5r-XtrWWL-
|
||||
bc69c6602d438413dcb9ceac112299ee253e4575
|
||||
yuHsGf712D1
|
||||
|
@ -29,7 +29,7 @@
|
||||
across goroutines. Here’s an example of using a
|
||||
blocking receive to wait for a goroutine to finish.
|
||||
When waiting for multiple goroutines to finish,
|
||||
you may prefer to <a href="waiting-for-goroutines-to-finish">use a WaitGroup</a>.</p>
|
||||
you may prefer to use a <a href="waitgroups">WaitGroup</a>.</p>
|
||||
|
||||
</td>
|
||||
<td class="code empty leading">
|
||||
@ -43,7 +43,7 @@ you may prefer to <a href="waiting-for-goroutines-to-finish">use a WaitGroup</a>
|
||||
|
||||
</td>
|
||||
<td class="code leading">
|
||||
<a href="http://play.golang.org/p/f6qTtt1agmN"><img title="Run code" src="play.png" class="run" /></a>
|
||||
<a href="http://play.golang.org/p/8lmP8beav0p"><img title="Run code" src="play.png" class="run" /></a>
|
||||
<div class="highlight"><pre><span class="kn">package</span> <span class="nx">main</span>
|
||||
</pre></div>
|
||||
|
||||
|
@ -103,7 +103,7 @@
|
||||
|
||||
<li><a href="worker-pools">Worker Pools</a></li>
|
||||
|
||||
<li><a href="waitgroup">WaitGroup</a></li>
|
||||
<li><a href="waitgroups">WaitGroups</a></li>
|
||||
|
||||
<li><a href="rate-limiting">Rate Limiting</a></li>
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Go by Example: WaitGroup</title>
|
||||
<title>Go by Example: WaitGroups</title>
|
||||
<link rel=stylesheet href="site.css">
|
||||
</head>
|
||||
<script type="text/javascript">
|
||||
@ -18,8 +18,8 @@
|
||||
}
|
||||
</script>
|
||||
<body>
|
||||
<div class="example" id="waitgroup">
|
||||
<h2><a href="./">Go by Example</a>: WaitGroup</h2>
|
||||
<div class="example" id="waitgroups">
|
||||
<h2><a href="./">Go by Example</a>: WaitGroups</h2>
|
||||
|
||||
<table>
|
||||
|
||||
@ -40,7 +40,7 @@ use a <em>wait group</em>.</p>
|
||||
|
||||
</td>
|
||||
<td class="code leading">
|
||||
<a href="http://play.golang.org/p/8cD2V9CgI0J"><img title="Run code" src="play.png" class="run" /></a>
|
||||
<a href="http://play.golang.org/p/gLLmgcR7YkP"><img title="Run code" src="play.png" class="run" /></a>
|
||||
<div class="highlight"><pre><span class="kn">package</span> <span class="nx">main</span>
|
||||
</pre></div>
|
||||
|
||||
@ -95,7 +95,7 @@ pointer.</p>
|
||||
|
||||
<tr>
|
||||
<td class="docs">
|
||||
<p>Notify the WaitGroup that we’re done.</p>
|
||||
<p>Notify the WaitGroup that this worker is done.</p>
|
||||
|
||||
</td>
|
||||
<td class="code leading">
|
||||
@ -135,7 +135,7 @@ goroutines launched here to finish.</p>
|
||||
|
||||
<tr>
|
||||
<td class="docs">
|
||||
<p>Launch several goroutines and increment the WorkGroup
|
||||
<p>Launch several goroutines and increment the WaitGroup
|
||||
counter for each.</p>
|
||||
|
||||
</td>
|
||||
@ -152,7 +152,7 @@ counter for each.</p>
|
||||
|
||||
<tr>
|
||||
<td class="docs">
|
||||
<p>Block until the WorkGroup counter goes back to 0;
|
||||
<p>Block until the WaitGroup counter goes back to 0;
|
||||
all the workers notified they’re done.</p>
|
||||
|
||||
</td>
|
||||
@ -175,7 +175,7 @@ all the workers notified they’re done.</p>
|
||||
</td>
|
||||
<td class="code leading">
|
||||
|
||||
<div class="highlight"><pre><span class="gp">$</span> go run waitgroup.go
|
||||
<div class="highlight"><pre><span class="gp">$</span> go run waitgroups.go
|
||||
<span class="go">Worker 5 starting</span>
|
||||
<span class="go">Worker 3 starting</span>
|
||||
<span class="go">Worker 4 starting</span>
|
||||
@ -211,7 +211,7 @@ is likely to be different for each invocation.</p>
|
||||
</p>
|
||||
|
||||
<p class="footer">
|
||||
by <a href="https://markmcgranaghan.com">Mark McGranaghan</a> | <a href="https://github.com/mmcgrana/gobyexample/blob/master/examples/waitgroup">source</a> | <a href="https://github.com/mmcgrana/gobyexample#license">license</a>
|
||||
by <a href="https://markmcgranaghan.com">Mark McGranaghan</a> | <a href="https://github.com/mmcgrana/gobyexample/blob/master/examples/waitgroups">source</a> | <a href="https://github.com/mmcgrana/gobyexample#license">license</a>
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
@ -40,7 +40,7 @@ a <em>worker pool</em> using goroutines and channels.</p>
|
||||
|
||||
</td>
|
||||
<td class="code leading">
|
||||
<a href="http://play.golang.org/p/Q5r-XtrWWL-"><img title="Run code" src="play.png" class="run" /></a>
|
||||
<a href="http://play.golang.org/p/yuHsGf712D1"><img title="Run code" src="play.png" class="run" /></a>
|
||||
<div class="highlight"><pre><span class="kn">package</span> <span class="nx">main</span>
|
||||
</pre></div>
|
||||
|
||||
@ -150,7 +150,7 @@ channel to indicate that’s all the work we have.</p>
|
||||
<p>Finally we collect all the results of the work.
|
||||
This also ensures that the worker goroutines have
|
||||
finished. An alternative way to wait for multiple
|
||||
goroutines is to use a <a href="waitgroup">WaitGroup</a>.</p>
|
||||
goroutines is to use a <a href="waitgroups">WaitGroup</a>.</p>
|
||||
|
||||
</td>
|
||||
<td class="code">
|
||||
@ -210,7 +210,7 @@ there are 3 workers operating concurrently.</p>
|
||||
|
||||
|
||||
<p class="next">
|
||||
Next example: <a href="waitgroup">WaitGroup</a>.
|
||||
Next example: <a href="waitgroups">WaitGroups</a>.
|
||||
</p>
|
||||
|
||||
<p class="footer">
|
||||
|
Loading…
x
Reference in New Issue
Block a user