This commit is contained in:
Mark McGranaghan 2020-08-23 07:50:27 -07:00
parent 25cf6d9e69
commit 7d87b1b9f0
2 changed files with 4 additions and 4 deletions

View File

@ -1,2 +1,2 @@
fb913ae361c41095a39bb3fa0c5e9dcd54ec840e
4oOz0j29MJ6
79963f30cb3ca93d559a409e3ded40c2bb64df66
gyr0NbVKBVf

4
public/timeouts generated
View File

@ -44,7 +44,7 @@ elegant thanks to channels and <code>select</code>.</p>
</td>
<td class="code leading">
<a href="http://play.golang.org/p/4oOz0j29MJ6"><img title="Run code" src="play.png" class="run" /></a><img title="Copy code" src="clipboard.png" class="copy" />
<a href="http://play.golang.org/p/gyr0NbVKBVf"><img title="Run code" src="play.png" class="run" /></a><img title="Copy code" src="clipboard.png" class="copy" />
<div class="highlight"><pre><span class="kn">package</span> <span class="nx">main</span>
</pre></div>
@ -103,7 +103,7 @@ channel is never read.</p>
<tr>
<td class="docs">
<p>Here&rsquo;s the <code>select</code> implementing a timeout.
<code>res := &lt;-c1</code> awaits the result and <code>&lt;-Time.After</code>
<code>res := &lt;-c1</code> awaits the result and <code>&lt;-time.After</code>
awaits a value to be sent after the timeout of
1s. Since <code>select</code> proceeds with the first
receive that&rsquo;s ready, we&rsquo;ll take the timeout case