[llvm-commits] [llvm] r73587 - in /llvm/trunk: autoconf/configure.ac configure include/llvm/System/Atomic.h include/llvm/Type.h lib/System/Atomic.cpp
Anton Korobeynikov
anton at korobeynikov.info
Tue Jun 16 18:45:11 PDT 2009
Hi, Owen
> +sys::cas_flag sys::AtomicPostIncrement(volatile sys::cas_flag* ptr) {
> +#if LLVM_MULTITHREADED==0
> + ++(*ptr);
> + return *ptr;
> +#elif defined(__GNUC__)
> + return __sync_add_and_fetch(ptr, 1);
> +#elif defined(_MSC_VER)
> + return InterlockedCompareExchange(ptr, new_value, old_value);
> +#else
> +# error No atomic increment implementation for your platform!
> +#endif
Do not forget about mingw32! If you use gcc 3.4.6 there, then there
will be no atomic builtins, but you can sure use mentioned windows API
calls (_MSC_VER is not defined there).
--
With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University
More information about the llvm-commits
mailing list