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
|
||||
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:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue