1 #ifndef ATOMIC_NOLOCK_INCLUDED
2 #define ATOMIC_NOLOCK_INCLUDED
3 
4 /* Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. reserved.
5    reserved.
6 
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License, version 2.0,
9    as published by the Free Software Foundation.
10 
11    This program is also distributed with certain software (including
12    but not limited to OpenSSL) that is licensed under separate terms,
13    as designated in a particular file or component or in included license
14    documentation.  The authors of MySQL hereby grant you an additional
15    permission to link the program and your derivative works with the
16    separately licensed software that they have included with MySQL.
17 
18    This program is distributed in the hope that it will be useful,
19    but WITHOUT ANY WARRANTY; without even the implied warranty of
20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21    GNU General Public License, version 2.0, for more details.
22 
23    You should have received a copy of the GNU General Public License
24    along with this program; if not, write to the Free Software
25    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
26 
27 /*
28   We choose implementation as follows:
29   ------------------------------------
30   On Windows using Visual C++ the native implementation should be
31   preferrable. When using gcc we prefer the Solaris implementation
32   before the gcc because of stability preference, we choose gcc
33   builtins if available, otherwise we fallback to rw locks. If
34   neither Visual C++ or gcc we still choose the Solaris
35   implementation on Solaris (mainly for SunStudio compilers).
36 */
37 #  if defined(_MSC_VER)
38 #    include "generic-msvc.h"
39 #  elif __GNUC__
40 #    if defined(HAVE_SOLARIS_ATOMIC)
41 #      include "solaris.h"
42 #    elif defined(HAVE_GCC_ATOMIC_BUILTINS)
43 #      include "gcc_builtins.h"
44 #    endif
45 #  elif defined(HAVE_SOLARIS_ATOMIC)
46 #    include "solaris.h"
47 #  endif
48 
49 #if defined(make_atomic_cas_body)
50 /*
51   Type not used so minimal size (emptry struct has different size between C
52   and C++, zero-length array is gcc-specific).
53 */
54 typedef char my_atomic_rwlock_t MY_ATTRIBUTE ((unused));
55 #define my_atomic_rwlock_destroy(name)
56 #define my_atomic_rwlock_init(name)
57 #define my_atomic_rwlock_rdlock(name)
58 #define my_atomic_rwlock_wrlock(name)
59 #define my_atomic_rwlock_rdunlock(name)
60 #define my_atomic_rwlock_wrunlock(name)
61 
62 #endif
63 
64 #endif /* ATOMIC_NOLOCK_INCLUDED */
65