Skip to content

Commit

Permalink
deploy: bcc2849
Browse files Browse the repository at this point in the history
  • Loading branch information
Araq committed Sep 8, 2023
1 parent eaa37f6 commit 24f3613
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 31 deletions.
2 changes: 1 addition & 1 deletion atomics.html
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ <h1><a class="toc-backref" href="#12">Procs</a></h1>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-08-30 15:54:18 UTC</small>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-09-08 06:23:29 UTC</small>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion channels.html
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ <h1><a class="toc-backref" href="#18">Templates</a></h1>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-08-30 15:54:17 UTC</small>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-09-08 06:23:27 UTC</small>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ <h1 class="title">Index</h1>
</ul></dd>
<dt><a name="enter" href="#enter"><span>enter:</span></a></dt><dd><ul class="simple">
<li><a class="reference external"
data-doc-search-tag="waitgroups: proc enter(b: var WaitGroup; delta = 1)" href="waitgroups.html#enter%2CWaitGroup%2Cint">waitgroups: proc enter(b: var WaitGroup; delta = 1)</a></li>
data-doc-search-tag="waitgroups: proc enter(b: var WaitGroup; delta: Natural = 1)" href="waitgroups.html#enter%2CWaitGroup%2CNatural">waitgroups: proc enter(b: var WaitGroup; delta: Natural = 1)</a></li>
</ul></dd>
<dt><a name="exchange" href="#exchange"><span>exchange:</span></a></dt><dd><ul class="simple">
<li><a class="reference external"
Expand Down Expand Up @@ -268,7 +268,7 @@ <h1 class="title">Index</h1>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-08-30 15:54:19 UTC</small>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-09-08 06:23:31 UTC</small>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion smartptrs.html
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ <h1><a class="toc-backref" href="#18">Templates</a></h1>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-08-30 15:54:18 UTC</small>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-09-08 06:23:29 UTC</small>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions theindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ <h1 class="title">Index</h1>
</ul></dd>
<dt><a name="enter" href="#enter"><span>enter:</span></a></dt><dd><ul class="simple">
<li><a class="reference external"
data-doc-search-tag="waitgroups: proc enter(b: var WaitGroup; delta = 1)" href="waitgroups.html#enter%2CWaitGroup%2Cint">waitgroups: proc enter(b: var WaitGroup; delta = 1)</a></li>
data-doc-search-tag="waitgroups: proc enter(b: var WaitGroup; delta: Natural = 1)" href="waitgroups.html#enter%2CWaitGroup%2CNatural">waitgroups: proc enter(b: var WaitGroup; delta: Natural = 1)</a></li>
</ul></dd>
<dt><a name="exchange" href="#exchange"><span>exchange:</span></a></dt><dd><ul class="simple">
<li><a class="reference external"
Expand Down Expand Up @@ -268,7 +268,7 @@ <h1 class="title">Index</h1>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-08-30 15:54:19 UTC</small>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-09-08 06:23:31 UTC</small>
</div>
</div>
</div>
Expand Down
57 changes: 38 additions & 19 deletions waitgroups.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ <h1 class="title">threading/waitgroups</h1>

</ul>
<ul class="simple nested-toc-section">enter
<li><a class="reference" href="#enter%2CWaitGroup%2Cint" title="enter(b: var WaitGroup; delta = 1)">enter(b: var WaitGroup; delta = 1)</a></li>
<li><a class="reference" href="#enter%2CWaitGroup%2CNatural" title="enter(b: var WaitGroup; delta: Natural = 1)">enter(b: var WaitGroup; delta: Natural = 1)</a></li>

</ul>
<ul class="simple nested-toc-section">leave
Expand All @@ -90,7 +90,27 @@ <h1 class="title">threading/waitgroups</h1>

<div id="tocRoot"></div>

<p class="module-desc">Wait groups for Nim.</p>
<p class="module-desc">Wait groups for Nim.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">import</span> <span class="Identifier">threading</span><span class="Operator">/</span><span class="Identifier">waitgroups</span>

<span class="Keyword">var</span> <span class="Identifier">data</span><span class="Punctuation">:</span> <span class="Identifier">array</span><span class="Punctuation">[</span><span class="DecNumber">10</span><span class="Punctuation">,</span> <span class="Identifier">int</span><span class="Punctuation">]</span>
<span class="Keyword">var</span> <span class="Identifier">wg</span> <span class="Operator">=</span> <span class="Identifier">createWaitGroup</span><span class="Punctuation">(</span><span class="Punctuation">)</span>

<span class="Keyword">proc</span> <span class="Identifier">worker</span><span class="Punctuation">(</span><span class="Identifier">i</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">)</span> <span class="Operator">=</span>
<span class="Identifier">data</span><span class="Punctuation">[</span><span class="Identifier">i</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="DecNumber">42</span>
<span class="Identifier">wg</span><span class="Operator">.</span><span class="Identifier">leave</span><span class="Punctuation">(</span><span class="Punctuation">)</span>

<span class="Keyword">var</span> <span class="Identifier">threads</span><span class="Punctuation">:</span> <span class="Identifier">array</span><span class="Punctuation">[</span><span class="DecNumber">10</span><span class="Punctuation">,</span> <span class="Identifier">Thread</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span><span class="Punctuation">]</span>
<span class="Identifier">wg</span><span class="Operator">.</span><span class="Identifier">enter</span><span class="Punctuation">(</span><span class="DecNumber">10</span><span class="Punctuation">)</span>
<span class="Keyword">for</span> <span class="Identifier">i</span> <span class="Keyword">in</span> <span class="FloatNumber">0.</span><span class="Operator">.&lt;</span><span class="DecNumber">10</span><span class="Punctuation">:</span>
<span class="Identifier">createThread</span><span class="Punctuation">(</span><span class="Identifier">threads</span><span class="Punctuation">[</span><span class="Identifier">i</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="Identifier">worker</span><span class="Punctuation">,</span> <span class="Identifier">i</span><span class="Punctuation">)</span>

<span class="Identifier">wg</span><span class="Operator">.</span><span class="Identifier">wait</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
<span class="Keyword">for</span> <span class="Identifier">x</span> <span class="Keyword">in</span> <span class="Identifier">data</span><span class="Punctuation">:</span>
<span class="Identifier">assert</span> <span class="Identifier">x</span> <span class="Operator">==</span> <span class="DecNumber">42</span>

<span class="Identifier">joinThreads</span><span class="Punctuation">(</span><span class="Identifier">threads</span><span class="Punctuation">)</span></pre></p>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
Expand All @@ -99,10 +119,9 @@ <h1><a class="toc-backref" href="#7">Types</a></h1>
</pre></dt>
<dd>


A WaitGroup is an synchronization object that can be used to <tt class="docutils literal"><span class="pre"><span class="Identifier">wait</span></span></tt> until all workers have completed.
<a href="https://github.com/nim-lang/threading/tree/master/threading/waitgroups.nim#L14" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/threading/edit/devel/threading/waitgroups.nim#L14" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
A <tt class="docutils literal"><span class="pre"><span class="Identifier">WaitGroup</span></span></tt> is a synchronization object that can be used to <tt class="docutils literal"><span class="pre"><span class="Identifier">wait</span></span></tt> until all workers have completed.
<a href="https://github.com/nim-lang/threading/tree/master/threading/waitgroups.nim#L35" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/threading/edit/devel/threading/waitgroups.nim#L35" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;

</dd>
</div>
Expand All @@ -118,22 +137,22 @@ <h1><a class="toc-backref" href="#12">Procs</a></h1>
<dd>


<a href="https://github.com/nim-lang/threading/tree/master/threading/waitgroups.nim#L34" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/threading/edit/devel/threading/waitgroups.nim#L34" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/threading/tree/master/threading/waitgroups.nim#L55" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/threading/edit/devel/threading/waitgroups.nim#L55" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;

</dd>
</div>

</div>
<div id="enter-procs-all">
<div id="enter,WaitGroup,int">
<dt><pre><span class="Keyword">proc</span> <a href="#enter%2CWaitGroup%2Cint"><span class="Identifier">enter</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="waitgroups.html#WaitGroup"><span class="Identifier">WaitGroup</span></a><span class="Other">;</span> <span class="Identifier">delta</span> <span class="Other">=</span> <span class="DecNumber">1</span><span class="Other">)</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<div id="enter,WaitGroup,Natural">
<dt><pre><span class="Keyword">proc</span> <a href="#enter%2CWaitGroup%2CNatural"><span class="Identifier">enter</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="waitgroups.html#WaitGroup"><span class="Identifier">WaitGroup</span></a><span class="Other">;</span> <span class="Identifier">delta</span><span class="Other">:</span> <span class="Identifier">Natural</span> <span class="Other">=</span> <span class="DecNumber">1</span><span class="Other">)</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>

Tells the WaitGroup that one or more workers (the <tt class="docutils literal"><span class="pre"><span class="Identifier">delta</span></span></tt> parameter says how many) &quot;entered&quot; which means to increase the counter that counts how many workers to wait for.
<a href="https://github.com/nim-lang/threading/tree/master/threading/waitgroups.nim#L39" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/threading/edit/devel/threading/waitgroups.nim#L39" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
Tells the <tt class="docutils literal"><span class="pre"><span class="Identifier">WaitGroup</span></span></tt> that one or more workers (the <tt class="docutils literal"><span class="pre"><span class="Identifier">delta</span></span></tt> parameter says how many) &quot;entered&quot;, which means to increase the counter that counts how many workers to wait for.
<a href="https://github.com/nim-lang/threading/tree/master/threading/waitgroups.nim#L60" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/threading/edit/devel/threading/waitgroups.nim#L60" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;

</dd>
</div>
Expand All @@ -144,9 +163,9 @@ <h1><a class="toc-backref" href="#12">Procs</a></h1>
<dt><pre><span class="Keyword">proc</span> <a href="#leave%2CWaitGroup"><span class="Identifier">leave</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="waitgroups.html#WaitGroup"><span class="Identifier">WaitGroup</span></a><span class="Other">)</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>

Tells the WaitGroup that one worker has finished its task.
<a href="https://github.com/nim-lang/threading/tree/master/threading/waitgroups.nim#L47" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/threading/edit/devel/threading/waitgroups.nim#L47" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
Tells the <tt class="docutils literal"><span class="pre"><span class="Identifier">WaitGroup</span></span></tt> that one worker has finished its task.
<a href="https://github.com/nim-lang/threading/tree/master/threading/waitgroups.nim#L68" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/threading/edit/devel/threading/waitgroups.nim#L68" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;

</dd>
</div>
Expand All @@ -158,8 +177,8 @@ <h1><a class="toc-backref" href="#12">Procs</a></h1>
<dd>

Waits until all workers have completed.
<a href="https://github.com/nim-lang/threading/tree/master/threading/waitgroups.nim#L54" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/threading/edit/devel/threading/waitgroups.nim#L54" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/threading/tree/master/threading/waitgroups.nim#L77" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/threading/edit/devel/threading/waitgroups.nim#L77" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;

</dd>
</div>
Expand All @@ -175,7 +194,7 @@ <h1><a class="toc-backref" href="#12">Procs</a></h1>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-08-30 15:54:19 UTC</small>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-09-08 06:23:31 UTC</small>
</div>
</div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions waitgroups.idx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
nimTitle waitgroups waitgroups.html module threading/waitgroups 0
nim WaitGroup waitgroups.html#WaitGroup object WaitGroup 14
nim createWaitGroup waitgroups.html#createWaitGroup proc createWaitGroup(): WaitGroup 34
nim enter waitgroups.html#enter,WaitGroup,int proc enter(b: var WaitGroup; delta = 1) 39
nim leave waitgroups.html#leave,WaitGroup proc leave(b: var WaitGroup) 47
nim wait waitgroups.html#wait,WaitGroup proc wait(b: var WaitGroup) 54
nim WaitGroup waitgroups.html#WaitGroup object WaitGroup 35
nim createWaitGroup waitgroups.html#createWaitGroup proc createWaitGroup(): WaitGroup 55
nim enter waitgroups.html#enter,WaitGroup,Natural proc enter(b: var WaitGroup; delta: Natural = 1) 60
nim leave waitgroups.html#leave,WaitGroup proc leave(b: var WaitGroup) 68
nim wait waitgroups.html#wait,WaitGroup proc wait(b: var WaitGroup) 77

0 comments on commit 24f3613

Please sign in to comment.