blob: 552313f0c2412bfebc895832ac06d8159f607497 [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//===- 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// Windows will at times define MemoryFence.
24#ifdef MemoryFence
25#undef MemoryFence
26#endif
27
28namespace llvm {
29 namespace sys {
30 void MemoryFence();
31
32#ifdef _MSC_VER
33 typedef long cas_flag;
34#else
35 typedef uint32_t cas_flag;
36#endif
37 cas_flag CompareAndSwap(volatile cas_flag* ptr,
38 cas_flag new_value,
39 cas_flag old_value);
40 }
41}
42
43#endif