nolock.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef ATOMIC_NOLOCK_INCLUDED
  2. #define ATOMIC_NOLOCK_INCLUDED
  3. /* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; version 2 of the License.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
  14. #if defined(__i386__) || defined(_MSC_VER) || defined(__x86_64__) \
  15. || defined(HAVE_GCC_ATOMIC_BUILTINS) \
  16. || defined(HAVE_SOLARIS_ATOMIC)
  17. # ifdef MY_ATOMIC_MODE_DUMMY
  18. # define LOCK_prefix ""
  19. # else
  20. # define LOCK_prefix "lock"
  21. # endif
  22. /*
  23. We choose implementation as follows:
  24. ------------------------------------
  25. On Windows using Visual C++ the native implementation should be
  26. preferrable. When using gcc we prefer the Solaris implementation
  27. before the gcc because of stability preference, we choose gcc
  28. builtins if available, otherwise we choose the somewhat broken
  29. native x86 implementation. If neither Visual C++ or gcc we still
  30. choose the Solaris implementation on Solaris (mainly for SunStudio
  31. compilers).
  32. */
  33. # if defined(_MSC_VER)
  34. # include "generic-msvc.h"
  35. # elif __GNUC__
  36. # if defined(HAVE_SOLARIS_ATOMIC)
  37. # include "solaris.h"
  38. # elif defined(HAVE_GCC_ATOMIC_BUILTINS)
  39. # include "gcc_builtins.h"
  40. # elif defined(__i386__) || defined(__x86_64__)
  41. # include "x86-gcc.h"
  42. # endif
  43. # elif defined(HAVE_SOLARIS_ATOMIC)
  44. # include "solaris.h"
  45. # endif
  46. #endif
  47. #endif /* ATOMIC_NOLOCK_INCLUDED */