2010-11-29 19:44:50 +00:00
|
|
|
//===- llvm/Support/Atomic.h - Atomic Operations -----------------*- C++ -*-===//
|
2009-05-14 05:54:36 +00:00
|
|
|
//
|
2019-01-19 08:50:56 +00:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2009-05-14 05:54:36 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file declares the llvm::sys atomic operations.
|
|
|
|
//
|
2016-06-02 17:11:11 +00:00
|
|
|
// DO NOT USE IN NEW CODE!
|
|
|
|
//
|
|
|
|
// New code should always rely on the std::atomic facilities in C++11.
|
|
|
|
//
|
2009-05-14 05:54:36 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2013-01-10 00:45:19 +00:00
|
|
|
#ifndef LLVM_SUPPORT_ATOMIC_H
|
|
|
|
#define LLVM_SUPPORT_ATOMIC_H
|
2009-05-14 21:24:15 +00:00
|
|
|
|
2010-11-29 18:16:10 +00:00
|
|
|
#include "llvm/Support/DataTypes.h"
|
2009-05-14 05:54:36 +00:00
|
|
|
|
2017-02-14 01:38:14 +00:00
|
|
|
// Windows will at times define MemoryFence.
|
|
|
|
#ifdef MemoryFence
|
|
|
|
#undef MemoryFence
|
|
|
|
#endif
|
|
|
|
|
2009-05-14 05:54:36 +00:00
|
|
|
namespace llvm {
|
|
|
|
namespace sys {
|
2009-05-20 18:26:15 +00:00
|
|
|
void MemoryFence();
|
2009-05-15 11:04:52 +00:00
|
|
|
|
2009-12-07 05:29:59 +00:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
typedef long cas_flag;
|
|
|
|
#else
|
2009-06-23 20:17:22 +00:00
|
|
|
typedef uint32_t cas_flag;
|
2009-12-07 05:29:59 +00:00
|
|
|
#endif
|
2009-06-23 20:17:22 +00:00
|
|
|
cas_flag CompareAndSwap(volatile cas_flag* ptr,
|
|
|
|
cas_flag new_value,
|
|
|
|
cas_flag old_value);
|
2015-06-23 09:49:53 +00:00
|
|
|
}
|
|
|
|
}
|
2009-05-14 05:54:36 +00:00
|
|
|
|
2009-05-15 11:04:52 +00:00
|
|
|
#endif
|