aboutsummaryrefslogtreecommitdiff
path: root/src/sqliteInt.h
diff options
context:
space:
mode:
authordan <dan@noemail.net>2020-03-30 13:35:05 +0000
committerdan <dan@noemail.net>2020-03-30 13:35:05 +0000
commit892edb69c4f1071b682d88d13be45f7faa980f63 (patch)
tree8bceda36b2f53eb1fa1501a296a04cd6566bb403 /src/sqliteInt.h
parent3e42b9917566acdc67a04b08dbf8fc3227fc785d (diff)
downloadsqlite-892edb69c4f1071b682d88d13be45f7faa980f63.tar.gz
sqlite-892edb69c4f1071b682d88d13be45f7faa980f63.zip
Use __atomic_load_n() and __atomic_store_n() for a few more things where they are available.
FossilOrigin-Name: a49f8ec552bede7da731e0571ccf49de1a30e7be3a5673150436c8b411ba6ffc
Diffstat (limited to 'src/sqliteInt.h')
-rw-r--r--src/sqliteInt.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 489768bbc..d08c7ce1e 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -187,6 +187,21 @@
#endif
/*
+** WAL mode depends on atomic aligned 32-bit loads and stores in a few
+** places. The following macros try to make this explicit.
+*/
+#ifndef __has_feature
+# define __has_feature(x) 0 /* compatibility with non-clang compilers */
+#endif
+#if GCC_VERSION>=4007000 || __has_feature(c_atomic)
+# define AtomicLoad(PTR) __atomic_load_n((PTR),__ATOMIC_RELAXED)
+# define AtomicStore(PTR,VAL) __atomic_store_n((PTR),(VAL),__ATOMIC_RELAXED)
+#else
+# define AtomicLoad(PTR) (*(PTR))
+# define AtomicStore(PTR,VAL) (*(PTR) = (VAL))
+#endif
+
+/*
** Include standard header files as necessary
*/
#ifdef HAVE_STDINT_H