Index: src/mutex_unix.c ================================================================== --- src/mutex_unix.c +++ src/mutex_unix.c @@ -9,11 +9,11 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains the C functions that implement mutexes for pthreads ** -** $Id: mutex_unix.c,v 1.11 2008/06/19 08:51:24 danielk1977 Exp $ +** $Id: mutex_unix.c,v 1.12 2008/06/19 16:07:07 drh Exp $ */ #include "sqliteInt.h" /* ** The code in this file is only used if we are compiling threadsafe @@ -311,14 +311,15 @@ pthreadMutexAlloc, pthreadMutexFree, pthreadMutexEnter, pthreadMutexTry, pthreadMutexLeave, - +#ifdef SQLITE_DEBUG pthreadMutexHeld, pthreadMutexNotheld +#endif }; return &sMutex; } #endif /* SQLITE_MUTEX_PTHREAD */ Index: src/mutex_w32.c ================================================================== --- src/mutex_w32.c +++ src/mutex_w32.c @@ -9,11 +9,11 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains the C functions that implement mutexes for win32 ** -** $Id: mutex_w32.c,v 1.9 2008/06/19 08:51:24 danielk1977 Exp $ +** $Id: mutex_w32.c,v 1.10 2008/06/19 16:07:07 drh Exp $ */ #include "sqliteInt.h" /* ** The code in this file is only used if we are compiling multithreaded @@ -55,10 +55,12 @@ } return osType==2; } #endif /* OS_WINCE */ + +#ifdef SQLITE_DEBUG /* ** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are ** intended for use only inside assert() statements. */ static int winMutexHeld(sqlite3_mutex *p){ @@ -65,10 +67,11 @@ return p->nRef!=0 && p->owner==GetCurrentThreadId(); } static int winMutexNotheld(sqlite3_mutex *p){ return p->nRef==0 || p->owner!=GetCurrentThreadId(); } +#endif /* ** Initialize and deinitialize the mutex subsystem. */ @@ -228,14 +231,14 @@ winMutexAlloc, winMutexFree, winMutexEnter, winMutexTry, winMutexLeave, - +#ifdef SQLITE_DEBUG winMutexHeld, winMutexNotheld +#endif }; return &sMutex; } #endif /* SQLITE_MUTEX_W32 */ - Index: src/os.c ================================================================== --- src/os.c +++ src/os.c @@ -11,11 +11,11 @@ ****************************************************************************** ** ** This file contains OS interface code that is common to all ** architectures. ** -** $Id: os.c,v 1.114 2008/06/18 17:09:10 danielk1977 Exp $ +** $Id: os.c,v 1.115 2008/06/19 16:07:07 drh Exp $ */ #define _SQLITE_OS_C_ 1 #include "sqliteInt.h" #undef _SQLITE_OS_C_ @@ -197,10 +197,12 @@ /* ** Locate a VFS by name. If no name is given, simply return the ** first VFS on the list. */ sqlite3_vfs *sqlite3_vfs_find(const char *zVfs){ + sqlite3_vfs *pVfs = 0; + static int isInit = 0; #ifndef SQLITE_MUTEX_NOOP sqlite3_mutex *mutex; #endif #ifndef SQLITE_OMIT_AUTOINIT int rc = sqlite3_initialize(); @@ -207,12 +209,10 @@ if( rc ) return 0; #endif #ifndef SQLITE_MUTEX_NOOP mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); #endif - sqlite3_vfs *pVfs = 0; - static int isInit = 0; sqlite3_mutex_enter(mutex); if( !isInit ){ vfsList = sqlite3OsDefaultVfs(); isInit = 1; }