store a pointer to thread local storage to make the GC happy

This commit is contained in:
Araq 2011-05-16 00:50:46 +02:00
commit 6dd8c85051
2 changed files with 5 additions and 4 deletions

View file

@ -160,9 +160,9 @@ else:
type
TThread* {.pure, final.}[TParam] = object ## Nimrod thread.
sys: TSysThread
globals: pointer # this allows the GC to track thread local storage!
c: TThreadProcClosure[TParam]
when nodeadlocks:
var
lockList {.threadvar.}: ptr TLock
@ -283,7 +283,7 @@ proc createThread*[TParam](t: var TThread[TParam],
## proc `tp`. `param` is passed to `tp`.
t.c.data = param
t.c.fn = tp
CreateThreadLocalStorage()
t.globals = CreateThreadLocalStorage()
when hostOS == "windows":
var dummyThreadId: int32
t.sys = CreateThread(nil, 0'i32, threadProcWrapper[TParam],