Add thread enter/exit callbacks
This commit is contained in:
parent
291e14a32a
commit
3a6acbbe92
3 changed files with 21 additions and 1 deletions
|
|
@ -554,4 +554,16 @@ proc godot_gdnative_init(options: ptr GodotNativeInitOptions) {.
|
|||
|
||||
proc godot_gdnative_terminate(options: ptr GodotNativeTerminateOptions) {.
|
||||
cdecl, exportc, dynlib.} =
|
||||
deallocHeap()
|
||||
deallocHeap(runFinalizers = true, allowGcAfterwards = false)
|
||||
|
||||
proc godot_nativescript_thread_enter() {.
|
||||
cdecl, exportc, dynlib.} =
|
||||
when compileOption("threads"):
|
||||
setupForeignThreadGc()
|
||||
else:
|
||||
print(cstring"A foreign thread is created, but app is compiled without --threads:on. Bad things will happen if Nim code is invoked from this thread.")
|
||||
|
||||
proc godot_nativescript_thread_exit() {.
|
||||
cdecl, exportc, dynlib.} =
|
||||
when compileOption("threads"):
|
||||
teardownForeignThreadGc()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue