As a quick and dirty test, I did add the following in the ``mmdisp.nim`` file:
. code-block:: nimrod
proc boehmAllowRegisterThreads {.importc: "GC_allow_register_threads",
dynlib: boehmLib.}
type
GCStackBase = tuple
mem_base : pointer # Base of memory stack
reg_base : pointer # Base of separate register stack
proc boehmGetStackBase(base: ptr GCStackBase): int
{.importc: "GC_get_stack_base", dynlib: boehmLib.}
proc boehmRegisterMyThread(base: ptr GCStackBase): int
{.importc: "GC_register_my_thread", dynlib: boehmLib.}
proc boehmRegisterThisThread*() =
var base : GCStackBase
discard boehmGetStackBase(addr base)
discard boehmRegisterMyThread(addr base)
I did add a call to ``boehmAllowRegisterThreads`` after the ``GCinit``. I did
add a call to ``boehmRegisterThisThread`` at the beginning of the thread code
in my second example. That seems to do the trick :-) It works fine with that.
I think that the threads should be registered with the Boehm library this way.
I'm not sure where it should be called in the Nim code though.