'parallel' statement almost working
This commit is contained in:
parent
31b8fd66b1
commit
417b9f5a1d
10 changed files with 470 additions and 115 deletions
|
|
@ -209,12 +209,12 @@ when defined(windows) and not defined(gcc):
|
|||
proc interlockedCompareExchange(p: pointer; exchange, comparand: int32): int32
|
||||
{.importc: "InterlockedCompareExchange", header: "<windows.h>", cdecl.}
|
||||
|
||||
proc cas*[T: bool|int](p: ptr T; oldValue, newValue: T): bool =
|
||||
proc cas*[T: bool|int|ptr](p: ptr T; oldValue, newValue: T): bool =
|
||||
interlockedCompareExchange(p, newValue.int32, oldValue.int32) != 0
|
||||
|
||||
# XXX fix for 64 bit build
|
||||
else:
|
||||
# this is valid for GCC and Intel C++
|
||||
proc cas*[T: bool|int](p: ptr T; oldValue, newValue: T): bool
|
||||
proc cas*[T: bool|int|ptr](p: ptr T; oldValue, newValue: T): bool
|
||||
{.importc: "__sync_bool_compare_and_swap", nodecl.}
|
||||
# XXX is this valid for 'int'?
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue