1 //===- llvm/Support/Atomic.h - Atomic Operations -----------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file declares the llvm::sys atomic operations. 11 // 12 // DO NOT USE IN NEW CODE! 13 // 14 // New code should always rely on the std::atomic facilities in C++11. 15 // 16 //===----------------------------------------------------------------------===// 17 18 #ifndef LLVM_SUPPORT_ATOMIC_H 19 #define LLVM_SUPPORT_ATOMIC_H 20 21 #include "llvm/Support/DataTypes.h" 22 23 namespace llvm { 24 namespace sys { 25 void MemoryFence(); 26 27 #ifdef _MSC_VER 28 typedef long cas_flag; 29 #else 30 typedef uint32_t cas_flag; 31 #endif 32 cas_flag CompareAndSwap(volatile cas_flag* ptr, 33 cas_flag new_value, 34 cas_flag old_value); 35 } 36 } 37 38 #endif 39