Markdown code blocks part 5 (#20236)
No logic was added, just a few more `*.md` files have been migrated.
This commit is contained in:
parent
60f6724b70
commit
1c31de361d
21 changed files with 486 additions and 413 deletions
|
|
@ -28,7 +28,7 @@ the passed expression on the thread pool and returns a `data flow variable`:idx:
|
|||
**blocking**. However, one can use ``blockUntilAny`` to wait on multiple flow
|
||||
variables at the same time:
|
||||
|
||||
.. code-block:: nim
|
||||
```nim
|
||||
import std/threadpool, ...
|
||||
|
||||
# wait until 2 out of 3 servers received the update:
|
||||
|
|
@ -40,6 +40,7 @@ variables at the same time:
|
|||
assert index >= 0
|
||||
responses.del(index)
|
||||
discard blockUntilAny(responses)
|
||||
```
|
||||
|
||||
Data flow variables ensure that no data races
|
||||
are possible. Due to technical limitations not every type ``T`` is possible in
|
||||
|
|
@ -54,7 +55,7 @@ Parallel statement
|
|||
|
||||
Example:
|
||||
|
||||
.. code-block:: nim
|
||||
```nim
|
||||
# Compute PI in an inefficient way
|
||||
import std/[strutils, math, threadpool]
|
||||
|
||||
|
|
@ -69,6 +70,7 @@ Example:
|
|||
result += ch[k]
|
||||
|
||||
echo formatFloat(pi(5000))
|
||||
```
|
||||
|
||||
|
||||
The parallel statement is the preferred mechanism to introduce parallelism
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue