LLVM API Documentation

Atomic.h
Go to the documentation of this file.
00001 //===- llvm/Support/Atomic.h - Atomic Operations -----------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file declares the llvm::sys atomic operations.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_SUPPORT_ATOMIC_H
00015 #define LLVM_SUPPORT_ATOMIC_H
00016 
00017 #include "llvm/Support/DataTypes.h"
00018 
00019 namespace llvm {
00020   namespace sys {
00021     void MemoryFence();
00022 
00023 #ifdef _MSC_VER
00024     typedef long cas_flag;
00025 #else
00026     typedef uint32_t cas_flag;
00027 #endif
00028     cas_flag CompareAndSwap(volatile cas_flag* ptr,
00029                             cas_flag new_value,
00030                             cas_flag old_value);
00031     cas_flag AtomicIncrement(volatile cas_flag* ptr);
00032     cas_flag AtomicDecrement(volatile cas_flag* ptr);
00033     cas_flag AtomicAdd(volatile cas_flag* ptr, cas_flag val);
00034     cas_flag AtomicMul(volatile cas_flag* ptr, cas_flag val);
00035     cas_flag AtomicDiv(volatile cas_flag* ptr, cas_flag val);
00036   }
00037 }
00038 
00039 #endif