cyberdelia / atomic

An atomic class that guarantees atomic updates to its contained value.
https://atomic.readthedocs.org
MIT License
24 stars 5 forks source link

The function InterlockedCompareExchange should be _InterlockedCompareExchange #7

Closed aabdullah-bos closed 11 years ago

aabdullah-bos commented 11 years ago

In the function Refernce_compare_and_set you call:

InterlockedCompareExchange

however, this funciton is implemented as the compiler intrinsic:

_InterlockedCompareExchange ... see link below

http://msdn.microsoft.com/en-us/library/windows/desktop/ms683560(v=vs.85).aspx

Without this you get the link error:

c:\Users\whodoo\devel\tools>easy_install atomic
Processing atomic
Running setup.py -q bdist_egg --dist-dir c:\Users\whodoo\devel\tools\atomic\e
gg-dist-tmp-mpgowe
_reference.c
atomic/_reference.c(95) : warning C4013: **'InterlockedCompareExchange'** undefined;
 assuming extern returning int
atomic/_reference.c(95) : error C2065: 'old_value' : undeclared identifier
error: Setup script exited with error: command '"c:\Program Files (x86)\Microsof
t Visual Studio 9.0\VC\BIN\cl.exe"' failed with exit status 2

I am not sure if you need to include Windows.h, but I also added the following code at the top of _reference.c.

  #if defined(_MSC_VER)
  #include <Windows.h>
  #