documented the new .gcsafe override pragma
This commit is contained in:
parent
572fd067cf
commit
ebcc88238e
2 changed files with 16 additions and 2 deletions
|
|
@ -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
|
switch can be used. This is a temporary workaround to ease the porting effort
|
||||||
from old code to the new threading model.
|
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:
|
Future directions:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,5 +92,4 @@ restrictions / changes:
|
||||||
* Every array access has to be provably within bounds. This is called
|
* Every array access has to be provably within bounds. This is called
|
||||||
the *bounds check*.
|
the *bounds check*.
|
||||||
* Slices are optimized so that no copy is performed. This optimization is not
|
* Slices are optimized so that no copy is performed. This optimization is not
|
||||||
yet performed for ordinary slices outside of a ``parallel`` section. Slices
|
yet performed for ordinary slices outside of a ``parallel`` section.
|
||||||
are also special in that they currently do not support negative indexes!
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue