mirror of
https://github.com/nim-lang/Nim.git
synced 2026-09-07 22:17:28 +00:00
Memregion pool no handle (#26110)
Co-authored-by: SirOlaf <34164198+SirOlaf@users.noreply.github.com>
(cherry picked from commit 43f7631b1c)
This commit is contained in:
@@ -19,6 +19,13 @@ when not defined(useNimRtl):
|
||||
|
||||
threadType = ThreadType.NimThread
|
||||
|
||||
when hasThreadLocalAllocator and not emulatedThreadVars:
|
||||
proc setupForeignThreadGc*() {.gcsafe, raises: [].} =
|
||||
initThreadAllocator()
|
||||
|
||||
proc tearDownForeignThreadGc*() {.gcsafe, raises: [].} =
|
||||
releaseThreadAllocator()
|
||||
|
||||
when defined(gcDestructors):
|
||||
proc deallocThreadStorage(p: pointer) = c_free(p)
|
||||
else:
|
||||
@@ -79,6 +86,8 @@ else:
|
||||
deallocThreadStorage(thrd.rawStack)
|
||||
|
||||
proc threadProcWrapStackFrame[TArg](thrd: ptr Thread[TArg]) {.raises: [].} =
|
||||
when hasThreadLocalAllocator:
|
||||
initThreadAllocator()
|
||||
when defined(boehmgc):
|
||||
boehmGC_call_with_stack_base(threadProcWrapDispatch[TArg], thrd)
|
||||
elif not defined(nogc) and not defined(gogc) and not defined(gcRegions) and not usesDestructors:
|
||||
@@ -93,6 +102,8 @@ proc threadProcWrapStackFrame[TArg](thrd: ptr Thread[TArg]) {.raises: [].} =
|
||||
when declared(deallocOsPages): deallocOsPages()
|
||||
else:
|
||||
threadProcWrapDispatch(thrd)
|
||||
when hasThreadLocalAllocator:
|
||||
releaseThreadAllocator()
|
||||
|
||||
template nimThreadProcWrapperBody*(closure: untyped): untyped =
|
||||
var thrd = cast[ptr Thread[TArg]](closure)
|
||||
|
||||
Reference in New Issue
Block a user