clean up the documentation of threads (#21067)
* clean up the documentation of threads * cleanup
This commit is contained in:
parent
b59c657be3
commit
7a18c1ef44
2 changed files with 1 additions and 18 deletions
|
|
@ -8424,23 +8424,12 @@ This is only useful if the program is compiled as a dynamic library via the
|
|||
`--app:lib`:option: command-line option.
|
||||
|
||||
|
||||
|
||||
Threads
|
||||
=======
|
||||
|
||||
To enable thread support the `--threads:on`:option: command-line switch needs to
|
||||
be used. The [system module](system.html) module then contains several threading primitives.
|
||||
See the [channels](channels_builtin.html) modules
|
||||
for the low-level thread API. There are also high-level parallelism constructs
|
||||
available. See [spawn](manual_experimental.html#parallel-amp-spawn) for
|
||||
The `--threads:on`:option: command-line switch is enabled by default. The [typedthreads module](typedthreads.html) module then contains several threading primitives. See [spawn](manual_experimental.html#parallel-amp-spawn) for
|
||||
further details.
|
||||
|
||||
Nim's memory model for threads is quite different than that of other common
|
||||
programming languages (C, Pascal, Java): Each thread has its own (garbage
|
||||
collected) heap, and sharing of memory is restricted to global variables. This
|
||||
helps to prevent race conditions. GC efficiency is improved quite a lot,
|
||||
because the GC never has to stop other threads and see what they reference.
|
||||
|
||||
The only way to create a thread is via `spawn` or
|
||||
`createThread`. The invoked proc must not use `var` parameters nor must
|
||||
any of its parameters contain a `ref` or `closure` type. This enforces
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue