MySQL 5.6.14 Source Code Document
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
gcc_builtins.h
1
#ifndef ATOMIC_GCC_BUILTINS_INCLUDED
2
#define ATOMIC_GCC_BUILTINS_INCLUDED
3
4
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
5
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; version 2 of the License.
9
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
14
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
18
19
#define make_atomic_add_body(S) \
20
v= __sync_fetch_and_add(a, v);
21
#define make_atomic_fas_body(S) \
22
v= __sync_lock_test_and_set(a, v);
23
#define make_atomic_cas_body(S) \
24
int ## S sav; \
25
int ## S cmp_val= *cmp; \
26
sav= __sync_val_compare_and_swap(a, cmp_val, set);\
27
if (!(ret= (sav == cmp_val))) *cmp= sav
28
29
#ifdef MY_ATOMIC_MODE_DUMMY
30
#define make_atomic_load_body(S) ret= *a
31
#define make_atomic_store_body(S) *a= v
32
#define MY_ATOMIC_MODE "gcc-builtins-up"
33
34
#else
35
#define MY_ATOMIC_MODE "gcc-builtins-smp"
36
#define make_atomic_load_body(S) \
37
ret= __sync_fetch_and_or(a, 0);
38
#define make_atomic_store_body(S) \
39
(void) __sync_lock_test_and_set(a, v);
40
#endif
41
42
#endif
/* ATOMIC_GCC_BUILTINS_INCLUDED */
include
atomic
gcc_builtins.h
Generated on Sat Nov 9 2013 01:24:44 for MySQL 5.6.14 Source Code Document by
1.8.1.2