aboutsummaryrefslogtreecommitdiff
path: root/builtin/common/async_event.lua
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/common/async_event.lua')
0 files changed, 0 insertions, 0 deletions
'n82' href='#n82'>82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
/*
Minetest
Copyright (C) 2015 ShadowNinja <shadowninja@minetest.net>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef THREADING_ATOMIC_H
#define THREADING_ATOMIC_H


#if __cplusplus >= 201103L
	#include <atomic>
	template<typename T> using Atomic = std::atomic<T>;
#else

#define GCC_VERSION   (__GNUC__        * 100 + __GNUC_MINOR__)
#define CLANG_VERSION (__clang_major__ * 100 + __clang_minor__)
#if GCC_VERSION >= 407 || CLANG_VERSION >= 302
	#define ATOMIC_LOAD(T, v)      return __atomic_load_n(&(v),       __ATOMIC_SEQ_CST)
	#define ATOMIC_STORE(T, v, x)  __atomic_store (&(v), &(x), __ATOMIC_SEQ_CST); return x