summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorSpencer Stirling <spencer.stirling@activision.com>2015-06-09 11:59:26 -0600
committerSpencer Stirling <spencer.stirling@activision.com>2015-06-09 11:59:26 -0600
commitd152ccc1e2ae07cff4685a9d1b8146297fffba38 (patch)
tree091beba91fda2f39a35c5765b75c1d23bb3efa3f
parent25a19875172db5024c1edf7011a5b46996e4f543 (diff)
downloadNim-d152ccc1e2ae07cff4685a9d1b8146297fffba38.tar.gz
fixed threadpool and atomics to work with Visual Studio 32 and 64 bit
-rw-r--r--lib/pure/concurrency/threadpool.nim2
-rw-r--r--lib/system/atomics.nim4
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/pure/concurrency/threadpool.nim b/lib/pure/concurrency/threadpool.nim
index 749a2fa2d..43a9dea11 100644
--- a/lib/pure/concurrency/threadpool.nim
+++ b/lib/pure/concurrency/threadpool.nim
@@ -290,7 +290,7 @@ proc slave(w: ptr Worker) {.thread.} =
     readyWorker = w
     signal(gSomeReady)
     await(w.taskArrived)
-    assert(not w.ready)
+    #assert(not w.ready)  # doesn't work with Visual Studio
     w.f(w, w.data)
     if w.q.len != 0: w.cleanFlowVars
     if w.shutdown:
diff --git a/lib/system/atomics.nim b/lib/system/atomics.nim
index 0b16b63bf..158fe91bc 100644
--- a/lib/system/atomics.nim
+++ b/lib/system/atomics.nim
@@ -191,11 +191,11 @@ proc atomicDec*(memLoc: var int, x: int = 1): int =
     result = memLoc
 
 when defined(windows) and not someGcc:
-  proc interlockedCompareExchange(p: pointer; exchange, comparand: int32): int32
+  proc interlockedCompareExchange(p: pointer; exchange, comparand: int): int
     {.importc: "InterlockedCompareExchange", header: "<windows.h>", cdecl.}
 
   proc cas*[T: bool|int|ptr](p: ptr T; oldValue, newValue: T): bool =
-    interlockedCompareExchange(p, newValue.int32, oldValue.int32) != 0
+    interlockedCompareExchange(p, cast[int](newValue), cast[int](oldValue)) != 0
   # XXX fix for 64 bit build
 else:
   # this is valid for GCC and Intel C++