summary refs log tree commit diff stats
path: root/lib/system
diff options
context:
space:
mode:
authoralaviss <alaviss@users.noreply.github.com>2019-06-19 17:41:22 +0700
committerAndreas Rumpf <rumpf_a@web.de>2019-06-19 12:41:22 +0200
commit24ac13f653177bda9cc0b7aa7795acc7cee62c8d (patch)
treec445ef88cc5eb02f7233ca90361ebcb3cc046e1d /lib/system
parentf67be92512741c0472266bbb91f7d1acaa67e178 (diff)
downloadNim-24ac13f653177bda9cc0b7aa7795acc7cee62c8d.tar.gz
[bugfix] gc_common: export foreign thread gc docs (#11536)
Diffstat (limited to 'lib/system')
-rw-r--r--lib/system/gc_common.nim18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/system/gc_common.nim b/lib/system/gc_common.nim
index ef4d379f6..2077ab103 100644
--- a/lib/system/gc_common.nim
+++ b/lib/system/gc_common.nim
@@ -156,7 +156,7 @@ else:
   iterator items(first: var GcStack): ptr GcStack = yield addr(first)
   proc len(stack: var GcStack): int = 1
 
-when declared(threadType):
+when defined(nimdoc):
   proc setupForeignThreadGc*() {.gcsafe.} =
     ## Call this if you registered a callback that will be run from a thread not
     ## under your control. This has a cheap thread-local guard, so the GC for
@@ -165,11 +165,7 @@ when declared(threadType):
     ##
     ## This function is available only when ``--threads:on`` and ``--tlsEmulation:off``
     ## switches are used
-    if threadType == ThreadType.None:
-      var stackTop {.volatile.}: pointer
-      nimGC_setStackBottom(addr(stackTop))
-      initGC()
-      threadType = ThreadType.ForeignThread
+    discard
 
   proc tearDownForeignThreadGc*() {.gcsafe.} =
     ## Call this to tear down the GC, previously initialized by ``setupForeignThreadGc``.
@@ -178,6 +174,16 @@ when declared(threadType):
     ##
     ## This function is available only when ``--threads:on`` and ``--tlsEmulation:off``
     ## switches are used
+    discard
+elif declared(threadType):
+  proc setupForeignThreadGc*() {.gcsafe.} =
+    if threadType == ThreadType.None:
+      var stackTop {.volatile.}: pointer
+      nimGC_setStackBottom(addr(stackTop))
+      initGC()
+      threadType = ThreadType.ForeignThread
+
+  proc tearDownForeignThreadGc*() {.gcsafe.} =
     if threadType != ThreadType.ForeignThread:
       return
     when declared(deallocOsPages): deallocOsPages()