~ubuntu-branches/ubuntu/saucy/golang/saucy

« back to all changes in this revision

Viewing changes to doc/articles/concurrency_patterns.html

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2013-07-08 05:52:37 UTC
  • mfrom: (29.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20130708055237-at01839e0hp8z3ni
Tags: 2:1.1-1ubuntu1
016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
We can then use a <code>select</code> statement to receive from either
18
18
<code>ch</code> or <code>timeout</code>. If nothing arrives on <code>ch</code>
19
19
after one second, the timeout case is selected and the attempt to read from
20
 
<cde>ch</cde> is abandoned.
 
20
<code>ch</code> is abandoned.
21
21
</p>
22
22
 
23
23
{{code "/doc/progs/timeout1.go" `/select {/` `/STOP/`}}
64
64
</p>
65
65
 
66
66
<p>
67
 
This problem is a textbook of example of what is known as a
 
67
This problem is a textbook example of what is known as a
68
68
<a href="https://en.wikipedia.org/wiki/Race_condition">race condition</a>, but
69
69
the fix is trivial. We just make sure to buffer the channel <code>ch</code> (by
70
70
adding the buffer length as the second argument to <a href="/pkg/builtin/#make">make</a>),