summary refs log tree commit diff stats
path: root/lib/system
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-05-20 16:19:45 +0200
committerAraq <rumpf_a@web.de>2011-05-20 16:19:45 +0200
commit90ad1182191ed42f5c6cad707a112183b43b713c (patch)
tree01a8b4c1a6c5e861104d39e12e2f5aefb82856ea /lib/system
parentc70fa87471c6963dd39653358e2f0f8ac59797d9 (diff)
downloadNim-90ad1182191ed42f5c6cad707a112183b43b713c.tar.gz
pthread_key_t is respected to be an opaque type ...
Diffstat (limited to 'lib/system')
-rwxr-xr-xlib/system/excpt.nim25
1 files changed, 12 insertions, 13 deletions
diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim
index 12069ae37..bbe608fdc 100755
--- a/lib/system/excpt.nim
+++ b/lib/system/excpt.nim
@@ -67,21 +67,19 @@ when hasThreadSupport:
   else:
     {.passL: "-pthread".}
     {.passC: "-pthread".}
-
     type
-      Tpthread_key {.importc: "pthread_key_t", 
-                     header: "<sys/types.h>".} = distinct int32
-      TThreadVarSlot {.compilerproc.} = Tpthread_key
+      TThreadVarSlot {.importc: "pthread_key_t", pure, final,
+                     header: "<sys/types.h>".} = object
 
-    proc pthread_getspecific(a1: Tpthread_key): pointer {.
+    proc pthread_getspecific(a1: TThreadVarSlot): pointer {.
       importc: "pthread_getspecific", header: "<pthread.h>".}
-    proc pthread_key_create(a1: ptr Tpthread_key, 
+    proc pthread_key_create(a1: ptr TThreadVarSlot, 
                             destruct: proc (x: pointer) {.noconv.}): int32 {.
       importc: "pthread_key_create", header: "<pthread.h>".}
-    proc pthread_key_delete(a1: Tpthread_key): int32 {.
+    proc pthread_key_delete(a1: TThreadVarSlot): int32 {.
       importc: "pthread_key_delete", header: "<pthread.h>".}
 
-    proc pthread_setspecific(a1: Tpthread_key, a2: pointer): int32 {.
+    proc pthread_setspecific(a1: TThreadVarSlot, a2: pointer): int32 {.
       importc: "pthread_setspecific", header: "<pthread.h>".}
     
     proc specificDestroy(mem: pointer) {.noconv.} =
@@ -112,11 +110,12 @@ when hasThreadSupport:
       data: float # compiler should add thread local variables here!
     PGlobals* = ptr TGlobals
   
-  # it's more efficient to not use a global variable for the thread storage 
-  # slot, but to rely on the implementation to assign slot 0 for us... ;-)
-  var checkSlot = ThreadVarAlloc()
-  const globalsSlot = TThreadVarSlot(0)
-  assert checkSlot.int == globalsSlot.int
+  # XXX it'd be more efficient to not use a global variable for the 
+  # thread storage slot, but to rely on the implementation to assign slot 0
+  # for us... ;-)
+  var globalsSlot = ThreadVarAlloc()
+  #const globalsSlot = TThreadVarSlot(0)
+  #assert checkSlot.int == globalsSlot.int
 
   proc NewGlobals(): PGlobals = 
     result = cast[PGlobals](alloc0(sizeof(TGlobals)))