diff options
-rw-r--r-- | doc/manual/threads.txt | 15 | ||||
-rw-r--r-- | doc/spawn.txt | 3 |
2 files changed, 16 insertions, 2 deletions
diff --git a/doc/manual/threads.txt b/doc/manual/threads.txt index a1895362c..95bd93b98 100644 --- a/doc/manual/threads.txt +++ b/doc/manual/threads.txt @@ -49,6 +49,21 @@ To disable the GC-safety checking the ``--threadAnalysis:off`` command line switch can be used. This is a temporary workaround to ease the porting effort from old code to the new threading model. +To override the compiler's gcsafety analysis a ``{.gcsafe.}`` pragma block can +be used: + +.. code-block:: nim + + var + someGlobal: string = "some string here" + perThread {.threadvar.}: string + + proc setPerThread() = + {.gcsafe.}: + deepCopy(perThread, someGlobal) + + onThreadCreation(setPerThread) + Future directions: diff --git a/doc/spawn.txt b/doc/spawn.txt index 5d65243d2..522c94464 100644 --- a/doc/spawn.txt +++ b/doc/spawn.txt @@ -92,5 +92,4 @@ restrictions / changes: * Every array access has to be provably within bounds. This is called the *bounds check*. * Slices are optimized so that no copy is performed. This optimization is not - yet performed for ordinary slices outside of a ``parallel`` section. Slices - are also special in that they currently do not support negative indexes! + yet performed for ordinary slices outside of a ``parallel`` section. |