Rename waitgroup-->waitgroups

This commit is contained in:
Eli Bendersky 2019-05-30 06:12:09 -07:00
parent 074571d952
commit ec0b192e48
13 changed files with 25 additions and 25 deletions

View File

@ -32,7 +32,7 @@ Range over Channels
Timers Timers
Tickers Tickers
Worker Pools Worker Pools
WaitGroup WaitGroups
Rate Limiting Rate Limiting
Atomic Counters Atomic Counters
Mutexes Mutexes

View File

@ -2,7 +2,7 @@
// across goroutines. Here's an example of using a // across goroutines. Here's an example of using a
// blocking receive to wait for a goroutine to finish. // blocking receive to wait for a goroutine to finish.
// When waiting for multiple goroutines 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 package main

View File

@ -1,2 +1,2 @@
df90432a53832c045472981a9da23d1139fb2b5c eb022977181884c2ab0f2b69e50311769e67a509
f6qTtt1agmN 8lmP8beav0p

View File

@ -1,2 +0,0 @@
ffc6520e73ebfa2b8c470e3ef00fee55388234e0
8cD2V9CgI0J

View File

@ -0,0 +1,2 @@
499c7ee59b2ae06d2d3171768d9cf11762121a87
gLLmgcR7YkP

View File

@ -1,4 +1,4 @@
$ go run waitgroup.go $ go run waitgroups.go
Worker 5 starting Worker 5 starting
Worker 3 starting Worker 3 starting
Worker 4 starting Worker 4 starting

View File

@ -44,7 +44,7 @@ func main() {
// Finally we collect all the results of the work. // Finally we collect all the results of the work.
// This also ensures that the worker goroutines have // This also ensures that the worker goroutines have
// finished. An alternative way to wait for multiple // 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++ { for a := 1; a <= 5; a++ {
<-results <-results
} }

View File

@ -1,2 +1,2 @@
3f7712d470dcbfc0cdddc939bb80814baaff8bb0 bc69c6602d438413dcb9ceac112299ee253e4575
Q5r-XtrWWL- yuHsGf712D1

View File

@ -29,7 +29,7 @@
across goroutines. Here&rsquo;s an example of using a across goroutines. Here&rsquo;s an example of using a
blocking receive to wait for a goroutine to finish. blocking receive to wait for a goroutine to finish.
When waiting for multiple goroutines 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>
<td class="code empty leading"> <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>
<td class="code leading"> <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> <div class="highlight"><pre><span class="kn">package</span> <span class="nx">main</span>
</pre></div> </pre></div>

View File

@ -103,7 +103,7 @@
<li><a href="worker-pools">Worker Pools</a></li> <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> <li><a href="rate-limiting">Rate Limiting</a></li>

View File

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Go by Example: WaitGroup</title> <title>Go by Example: WaitGroups</title>
<link rel=stylesheet href="site.css"> <link rel=stylesheet href="site.css">
</head> </head>
<script type="text/javascript"> <script type="text/javascript">
@ -18,8 +18,8 @@
} }
</script> </script>
<body> <body>
<div class="example" id="waitgroup"> <div class="example" id="waitgroups">
<h2><a href="./">Go by Example</a>: WaitGroup</h2> <h2><a href="./">Go by Example</a>: WaitGroups</h2>
<table> <table>
@ -40,7 +40,7 @@ use a <em>wait group</em>.</p>
</td> </td>
<td class="code leading"> <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> <div class="highlight"><pre><span class="kn">package</span> <span class="nx">main</span>
</pre></div> </pre></div>
@ -95,7 +95,7 @@ pointer.</p>
<tr> <tr>
<td class="docs"> <td class="docs">
<p>Notify the WaitGroup that we&rsquo;re done.</p> <p>Notify the WaitGroup that this worker is done.</p>
</td> </td>
<td class="code leading"> <td class="code leading">
@ -135,7 +135,7 @@ goroutines launched here to finish.</p>
<tr> <tr>
<td class="docs"> <td class="docs">
<p>Launch several goroutines and increment the WorkGroup <p>Launch several goroutines and increment the WaitGroup
counter for each.</p> counter for each.</p>
</td> </td>
@ -152,7 +152,7 @@ counter for each.</p>
<tr> <tr>
<td class="docs"> <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&rsquo;re done.</p> all the workers notified they&rsquo;re done.</p>
</td> </td>
@ -175,7 +175,7 @@ all the workers notified they&rsquo;re done.</p>
</td> </td>
<td class="code leading"> <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 5 starting</span>
<span class="go">Worker 3 starting</span> <span class="go">Worker 3 starting</span>
<span class="go">Worker 4 starting</span> <span class="go">Worker 4 starting</span>
@ -211,7 +211,7 @@ is likely to be different for each invocation.</p>
</p> </p>
<p class="footer"> <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> </p>
</div> </div>
</body> </body>

View File

@ -40,7 +40,7 @@ a <em>worker pool</em> using goroutines and channels.</p>
</td> </td>
<td class="code leading"> <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> <div class="highlight"><pre><span class="kn">package</span> <span class="nx">main</span>
</pre></div> </pre></div>
@ -150,7 +150,7 @@ channel to indicate that&rsquo;s all the work we have.</p>
<p>Finally we collect all the results of the work. <p>Finally we collect all the results of the work.
This also ensures that the worker goroutines have This also ensures that the worker goroutines have
finished. An alternative way to wait for multiple 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>
<td class="code"> <td class="code">
@ -210,7 +210,7 @@ there are 3 workers operating concurrently.</p>
<p class="next"> <p class="next">
Next example: <a href="waitgroup">WaitGroup</a>. Next example: <a href="waitgroups">WaitGroups</a>.
</p> </p>
<p class="footer"> <p class="footer">