Update comment in Atomic Counter
Type: Refactoring Adding the text message from atomic-counters.sh file in examples to the comment in the code file.
This commit is contained in:
parent
bc9700aab3
commit
070261e43d
@ -34,6 +34,10 @@ func main() {
|
||||
// use `AddUint64`, giving it the memory
|
||||
// address of our `ops` counter with the
|
||||
// `&` syntax.
|
||||
|
||||
// Also try by replacing `atomic.AddUint64(&ops, 1)`
|
||||
// with `ops++` and see the difference in output each
|
||||
// time we run the example
|
||||
atomic.AddUint64(&ops, 1)
|
||||
}
|
||||
wg.Done()
|
||||
|
@ -1,2 +1,2 @@
|
||||
7b491b40d56a77b01d8e2bd08366de081a4e8d99
|
||||
j-14agntvEO
|
||||
411d812735b41f901f82f31f55e74895dc837574
|
||||
pWwgacr1iKb
|
||||
|
10
public/atomic-counters
generated
10
public/atomic-counters
generated
@ -46,7 +46,7 @@ counters</em> accessed by multiple goroutines.</p>
|
||||
|
||||
</td>
|
||||
<td class="code leading">
|
||||
<a href="https://go.dev/play/p/j-14agntvEO"><img title="Run code" src="play.png" class="run" /></a><img title="Copy code" src="clipboard.png" class="copy" />
|
||||
<a href="https://go.dev/play/p/pWwgacr1iKb"><img title="Run code" src="play.png" class="run" /></a><img title="Copy code" src="clipboard.png" class="copy" />
|
||||
<pre class="chroma"><span class="kn">package</span> <span class="nx">main</span>
|
||||
</pre>
|
||||
</td>
|
||||
@ -139,11 +139,15 @@ address of our <code>ops</code> counter with the
|
||||
|
||||
<tr>
|
||||
<td class="docs">
|
||||
|
||||
<p>Also try by replacing <code>atomic.AddUint64(&ops, 1)</code>
|
||||
with <code>ops++</code> and see the difference in output each
|
||||
time we run the example</p>
|
||||
|
||||
</td>
|
||||
<td class="code leading">
|
||||
|
||||
<pre class="chroma"> <span class="nx">atomic</span><span class="p">.</span><span class="nf">AddUint64</span><span class="p">(</span><span class="o">&</span><span class="nx">ops</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
||||
<pre class="chroma">
|
||||
<span class="nx">atomic</span><span class="p">.</span><span class="nf">AddUint64</span><span class="p">(</span><span class="o">&</span><span class="nx">ops</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
||||
<span class="p">}</span>
|
||||
<span class="nx">wg</span><span class="p">.</span><span class="nf">Done</span><span class="p">()</span>
|
||||
<span class="p">}()</span>
|
||||
|
Loading…
x
Reference in New Issue
Block a user