MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nolock.h
1 #ifndef ATOMIC_NOLOCK_INCLUDED
2 #define ATOMIC_NOLOCK_INCLUDED
3 
4 /* Copyright (c) 2006, 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 #if defined(__i386__) || defined(_MSC_VER) || defined(__x86_64__) \
20  || defined(HAVE_GCC_ATOMIC_BUILTINS) \
21  || defined(HAVE_SOLARIS_ATOMIC)
22 
23 # ifdef MY_ATOMIC_MODE_DUMMY
24 # define LOCK_prefix ""
25 # else
26 # define LOCK_prefix "lock"
27 # endif
28 /*
29  We choose implementation as follows:
30  ------------------------------------
31  On Windows using Visual C++ the native implementation should be
32  preferrable. When using gcc we prefer the Solaris implementation
33  before the gcc because of stability preference, we choose gcc
34  builtins if available, otherwise we choose the somewhat broken
35  native x86 implementation. If neither Visual C++ or gcc we still
36  choose the Solaris implementation on Solaris (mainly for SunStudio
37  compilers).
38 */
39 # if defined(_MSV_VER)
40 # include "generic-msvc.h"
41 # elif __GNUC__
42 # if defined(HAVE_SOLARIS_ATOMIC)
43 # include "solaris.h"
44 # elif defined(HAVE_GCC_ATOMIC_BUILTINS)
45 # include "gcc_builtins.h"
46 # elif defined(__i386__) || defined(__x86_64__)
47 # include "x86-gcc.h"
48 # endif
49 # elif defined(HAVE_SOLARIS_ATOMIC)
50 # include "solaris.h"
51 # endif
52 #endif
53 
54 #if defined(make_atomic_cas_body)
55 /*
56  Type not used so minimal size (emptry struct has different size between C
57  and C++, zero-length array is gcc-specific).
58 */
59 typedef char my_atomic_rwlock_t __attribute__ ((unused));
60 #define my_atomic_rwlock_destroy(name)
61 #define my_atomic_rwlock_init(name)
62 #define my_atomic_rwlock_rdlock(name)
63 #define my_atomic_rwlock_wrlock(name)
64 #define my_atomic_rwlock_rdunlock(name)
65 #define my_atomic_rwlock_wrunlock(name)
66 
67 #endif
68 
69 #endif /* ATOMIC_NOLOCK_INCLUDED */