summary refs log tree commit diff stats
path: root/lib/system/excpt.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-05-16 00:50:46 +0200
committerAraq <rumpf_a@web.de>2011-05-16 00:50:46 +0200
commit6dd8c850513956e38f78c02e173df2c4d7b05cf3 (patch)
tree937f23d80d6f82eec8c6de429a9443dd875ace2c /lib/system/excpt.nim
parent67a30d837132e8000d1a8b10ce3d32423d149318 (diff)
downloadNim-6dd8c850513956e38f78c02e173df2c4d7b05cf3.tar.gz
store a pointer to thread local storage to make the GC happy
Diffstat (limited to 'lib/system/excpt.nim')
-rwxr-xr-xlib/system/excpt.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim
index 9bdc69569..e2d3bea08 100755
--- a/lib/system/excpt.nim
+++ b/lib/system/excpt.nim
@@ -106,9 +106,10 @@ when hasThreadSupport:
     PGlobals = ptr TGlobals
 
   var globalsSlot = ThreadVarAlloc()
-  proc CreateThreadLocalStorage*() {.inl.} =
+  proc CreateThreadLocalStorage*(): pointer {.inl.} =
     isMultiThreaded = true
-    ThreadVarSetValue(globalsSlot, alloc0(sizeof(TGlobals)))
+    result = alloc0(sizeof(TGlobals))
+    ThreadVarSetValue(globalsSlot, result)
     
   proc GetGlobals(): PGlobals {.compilerRtl, inl.} =
     result = cast[PGlobals](ThreadVarGetValue(globalsSlot))