diff options
Diffstat (limited to 'lib/libsqlite3/src/mutex_w32.c')
-rw-r--r-- | lib/libsqlite3/src/mutex_w32.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/libsqlite3/src/mutex_w32.c b/lib/libsqlite3/src/mutex_w32.c index fc943acaa0c..9570bdc0bf4 100644 --- a/lib/libsqlite3/src/mutex_w32.c +++ b/lib/libsqlite3/src/mutex_w32.c @@ -78,6 +78,24 @@ static int winMutexNotheld(sqlite3_mutex *p){ #endif /* +** Try to provide a memory barrier operation, needed for initialization +** and also for the xShmBarrier method of the VFS in cases when SQLite is +** compiled without mutexes (SQLITE_THREADSAFE=0). +*/ +void sqlite3MemoryBarrier(void){ +#if defined(SQLITE_MEMORY_BARRIER) + SQLITE_MEMORY_BARRIER; +#elif defined(__GNUC__) + __sync_synchronize(); +#elif !defined(SQLITE_DISABLE_INTRINSIC) && \ + defined(_MSC_VER) && _MSC_VER>=1300 + _ReadWriteBarrier(); +#elif defined(MemoryBarrier) + MemoryBarrier(); +#endif +} + +/* ** Initialize and deinitialize the mutex subsystem. */ static sqlite3_mutex winMutex_staticMutexes[] = { |