~ubuntu-branches/ubuntu/wily/juju-mongodb/wily-proposed

« back to all changes in this revision

Viewing changes to .pc/0003-SERVER-12064-Use-gcc-atomic-builtins-if-available.patch/src/mongo/platform/atomic_intrinsics.h

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-01-07 16:47:27 UTC
  • Revision ID: package-import@ubuntu.com-20140107164727-1aeo20j3rdxhk4pk
Tags: 2.4.8-0ubuntu5
* Enable better support for alternative architectures:
  - 0001-SERVER-12064-Atomic-operations-for-gcc-non-Intel-arc.patch
    0002-SERVER-12065-Support-ARM-and-AArch64-builds.patch
    0003-SERVER-12064-Use-gcc-atomic-builtins-if-available.patch:
    Cherry picked changes from Robie Basak to enable atomic operations
    on non-Intel architectures.
  - 0004-Support-ppc64el-builds.patch: Add support for detection of
    powerpc64 as a 64-bit platform.
  - d/control: Enable arm64 and ppc64el architectures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*    Copyright 2012 10gen Inc.
 
2
 *
 
3
 *    Licensed under the Apache License, Version 2.0 (the "License");
 
4
 *    you may not use this file except in compliance with the License.
 
5
 *    You may obtain a copy of the License at
 
6
 *
 
7
 *    http://www.apache.org/licenses/LICENSE-2.0
 
8
 *
 
9
 *    Unless required by applicable law or agreed to in writing, software
 
10
 *    distributed under the License is distributed on an "AS IS" BASIS,
 
11
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
12
 *    See the License for the specific language governing permissions and
 
13
 *    limitations under the License.
 
14
 */
 
15
 
 
16
/**
 
17
 * WARNING(schwerin): Use with extreme caution.  Prefer the AtomicWord<> types from atomic_word.h.
 
18
 *
 
19
 * The atomic_intrinsics module provides low-level atomic operations for manipulating memory.
 
20
 * Implementations are platform specific, so this file describes the interface and includes
 
21
 * the appropriate os/compiler-specific headers.
 
22
 *
 
23
 * For supported word types, the atomic_intrinsics headers provide implementations of template
 
24
 * classes of the following form:
 
25
 *
 
26
 * template <typename T> class AtomicIntrinsics {
 
27
 *     static T load(volatile const T* value);
 
28
 *     static T store(volatile T* dest, T newValue);
 
29
 *     static T compareAndSwap(volatile T* dest, T expected, T newValue);
 
30
 *     static T swap(volatile T* dest, T newValue);
 
31
 *     static T fetchAndAdd(volatile T* dest, T increment);
 
32
 * };
 
33
 *
 
34
 * All of the functions assume that the volatile T pointers are naturally aligned, and may not
 
35
 * operate as expected, if they are not so aligned.
 
36
 *
 
37
 * The behavior of the functions is analogous to the same-named member functions of the AtomicWord
 
38
 * template type in atomic_word.h.
 
39
 */
 
40
 
 
41
#pragma once
 
42
 
 
43
#if defined(_WIN32)
 
44
#include "mongo/platform/atomic_intrinsics_win32.h"
 
45
#elif defined(__GNUC__)
 
46
#if defined(__i386__) || defined(__x86_64__)
 
47
#include "mongo/platform/atomic_intrinsics_gcc_intel.h"
 
48
#else
 
49
#include "mongo/platform/atomic_intrinsics_gcc_generic.h"
 
50
#endif
 
51
#else
 
52
#error "Unsupported os/compiler family"
 
53
#endif