| Index: third_party/sqlite/src/src/mutex.c
|
| diff --git a/third_party/sqlite/src/src/mutex.c b/third_party/sqlite/src/src/mutex.c
|
| index c7385158bcaa3552f7ce12fd4dbd4eda8b4ea1aa..869a4aeb08d262995bbffcc11b4e6debb8e3088f 100644
|
| --- a/third_party/sqlite/src/src/mutex.c
|
| +++ b/third_party/sqlite/src/src/mutex.c
|
| @@ -12,9 +12,6 @@
|
| ** This file contains the C functions that implement mutexes.
|
| **
|
| ** This file contains code that is common across all mutex implementations.
|
| -
|
| -**
|
| -** $Id: mutex.c,v 1.31 2009/07/16 18:21:18 drh Exp $
|
| */
|
| #include "sqliteInt.h"
|
|
|
| @@ -34,23 +31,26 @@ static SQLITE_WSD int mutexIsInit = 0;
|
| */
|
| int sqlite3MutexInit(void){
|
| int rc = SQLITE_OK;
|
| - if( sqlite3GlobalConfig.bCoreMutex ){
|
| - if( !sqlite3GlobalConfig.mutex.xMutexAlloc ){
|
| - /* If the xMutexAlloc method has not been set, then the user did not
|
| - ** install a mutex implementation via sqlite3_config() prior to
|
| - ** sqlite3_initialize() being called. This block copies pointers to
|
| - ** the default implementation into the sqlite3GlobalConfig structure.
|
| - */
|
| - sqlite3_mutex_methods *pFrom = sqlite3DefaultMutex();
|
| - sqlite3_mutex_methods *pTo = &sqlite3GlobalConfig.mutex;
|
| -
|
| - memcpy(pTo, pFrom, offsetof(sqlite3_mutex_methods, xMutexAlloc));
|
| - memcpy(&pTo->xMutexFree, &pFrom->xMutexFree,
|
| - sizeof(*pTo) - offsetof(sqlite3_mutex_methods, xMutexFree));
|
| - pTo->xMutexAlloc = pFrom->xMutexAlloc;
|
| + if( !sqlite3GlobalConfig.mutex.xMutexAlloc ){
|
| + /* If the xMutexAlloc method has not been set, then the user did not
|
| + ** install a mutex implementation via sqlite3_config() prior to
|
| + ** sqlite3_initialize() being called. This block copies pointers to
|
| + ** the default implementation into the sqlite3GlobalConfig structure.
|
| + */
|
| + sqlite3_mutex_methods const *pFrom;
|
| + sqlite3_mutex_methods *pTo = &sqlite3GlobalConfig.mutex;
|
| +
|
| + if( sqlite3GlobalConfig.bCoreMutex ){
|
| + pFrom = sqlite3DefaultMutex();
|
| + }else{
|
| + pFrom = sqlite3NoopMutex();
|
| }
|
| - rc = sqlite3GlobalConfig.mutex.xMutexInit();
|
| + memcpy(pTo, pFrom, offsetof(sqlite3_mutex_methods, xMutexAlloc));
|
| + memcpy(&pTo->xMutexFree, &pFrom->xMutexFree,
|
| + sizeof(*pTo) - offsetof(sqlite3_mutex_methods, xMutexFree));
|
| + pTo->xMutexAlloc = pFrom->xMutexAlloc;
|
| }
|
| + rc = sqlite3GlobalConfig.mutex.xMutexInit();
|
|
|
| #ifdef SQLITE_DEBUG
|
| GLOBAL(int, mutexIsInit) = 1;
|
| @@ -150,4 +150,4 @@ int sqlite3_mutex_notheld(sqlite3_mutex *p){
|
| }
|
| #endif
|
|
|
| -#endif /* SQLITE_OMIT_MUTEX */
|
| +#endif /* SQLITE_MUTEX_OMIT */
|
|
|