diff options
author | Araq <rumpf_a@web.de> | 2011-05-16 00:50:46 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-05-16 00:50:46 +0200 |
commit | 6dd8c850513956e38f78c02e173df2c4d7b05cf3 (patch) | |
tree | 937f23d80d6f82eec8c6de429a9443dd875ace2c /lib/system/excpt.nim | |
parent | 67a30d837132e8000d1a8b10ce3d32423d149318 (diff) | |
download | Nim-6dd8c850513956e38f78c02e173df2c4d7b05cf3.tar.gz |
store a pointer to thread local storage to make the GC happy
Diffstat (limited to 'lib/system/excpt.nim')
-rwxr-xr-x | lib/system/excpt.nim | 5 |
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)) |