2010-11-29 20:44:50 +01:00
|
|
|
//===- llvm/Support/Atomic.h - Atomic Operations -----------------*- C++ -*-===//
|
2009-05-14 07:54:36 +02:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file declares the llvm::sys atomic operations.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2009-05-14 23:24:15 +02:00
|
|
|
#ifndef LLVM_SYSTEM_ATOMIC_H
|
|
|
|
#define LLVM_SYSTEM_ATOMIC_H
|
|
|
|
|
2010-11-29 19:16:10 +01:00
|
|
|
#include "llvm/Support/DataTypes.h"
|
2009-05-14 07:54:36 +02:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
namespace sys {
|
2009-05-20 20:26:15 +02:00
|
|
|
void MemoryFence();
|
2009-05-15 13:04:52 +02:00
|
|
|
|
2009-12-07 06:29:59 +01:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
typedef long cas_flag;
|
|
|
|
#else
|
2009-06-23 22:17:22 +02:00
|
|
|
typedef uint32_t cas_flag;
|
2009-12-07 06:29:59 +01:00
|
|
|
#endif
|
2009-06-23 22:17:22 +02:00
|
|
|
cas_flag CompareAndSwap(volatile cas_flag* ptr,
|
|
|
|
cas_flag new_value,
|
|
|
|
cas_flag old_value);
|
|
|
|
cas_flag AtomicIncrement(volatile cas_flag* ptr);
|
|
|
|
cas_flag AtomicDecrement(volatile cas_flag* ptr);
|
|
|
|
cas_flag AtomicAdd(volatile cas_flag* ptr, cas_flag val);
|
2009-06-23 23:19:04 +02:00
|
|
|
cas_flag AtomicMul(volatile cas_flag* ptr, cas_flag val);
|
|
|
|
cas_flag AtomicDiv(volatile cas_flag* ptr, cas_flag val);
|
2009-05-14 07:54:36 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-15 13:04:52 +02:00
|
|
|
#endif
|