[bugfix] gc_common: export foreign thread gc docs (#11536)
This commit is contained in:
parent
f67be92512
commit
24ac13f653
1 changed files with 12 additions and 6 deletions
|
|
@ -156,7 +156,7 @@ else:
|
||||||
iterator items(first: var GcStack): ptr GcStack = yield addr(first)
|
iterator items(first: var GcStack): ptr GcStack = yield addr(first)
|
||||||
proc len(stack: var GcStack): int = 1
|
proc len(stack: var GcStack): int = 1
|
||||||
|
|
||||||
when declared(threadType):
|
when defined(nimdoc):
|
||||||
proc setupForeignThreadGc*() {.gcsafe.} =
|
proc setupForeignThreadGc*() {.gcsafe.} =
|
||||||
## Call this if you registered a callback that will be run from a thread not
|
## 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
|
## 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``
|
## This function is available only when ``--threads:on`` and ``--tlsEmulation:off``
|
||||||
## switches are used
|
## switches are used
|
||||||
if threadType == ThreadType.None:
|
discard
|
||||||
var stackTop {.volatile.}: pointer
|
|
||||||
nimGC_setStackBottom(addr(stackTop))
|
|
||||||
initGC()
|
|
||||||
threadType = ThreadType.ForeignThread
|
|
||||||
|
|
||||||
proc tearDownForeignThreadGc*() {.gcsafe.} =
|
proc tearDownForeignThreadGc*() {.gcsafe.} =
|
||||||
## Call this to tear down the GC, previously initialized by ``setupForeignThreadGc``.
|
## 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``
|
## This function is available only when ``--threads:on`` and ``--tlsEmulation:off``
|
||||||
## switches are used
|
## 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:
|
if threadType != ThreadType.ForeignThread:
|
||||||
return
|
return
|
||||||
when declared(deallocOsPages): deallocOsPages()
|
when declared(deallocOsPages): deallocOsPages()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue