/ Check-in [535ed0ac]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Allocation the mutex used by the Win32 VFS only once at initialization, instead of every time it is needed.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 535ed0ac5e8728ec91fc0a4cb54b820923d161cfd4e0e6aed6df6cdae365bc7d
User & Date: mistachkin 2018-02-05 20:42:50
Context
2018-02-05
21:02
Adjust the previous check-in, which modified the Win32 VFS, so that it works with SQLITE_OMIT_WAL. check-in: 36c2e67e user: mistachkin tags: trunk
20:42
Allocation the mutex used by the Win32 VFS only once at initialization, instead of every time it is needed. check-in: 535ed0ac user: mistachkin tags: trunk
16:39
Allocation the mutex used by the unix VFS only once at initialization, instead of every time it is needed. check-in: 5764dc16 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_win.c.

  3627   3627   ** is held when required. This function is only used as part of assert()
  3628   3628   ** statements. e.g.
  3629   3629   **
  3630   3630   **   winShmEnterMutex()
  3631   3631   **     assert( winShmMutexHeld() );
  3632   3632   **   winShmLeaveMutex()
  3633   3633   */
         3634  +static sqlite3_mutex *winBigLock = 0;
  3634   3635   static void winShmEnterMutex(void){
  3635         -  sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1));
         3636  +  sqlite3_mutex_enter(winBigLock);
  3636   3637   }
  3637   3638   static void winShmLeaveMutex(void){
  3638         -  sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1));
         3639  +  sqlite3_mutex_leave(winBigLock);
  3639   3640   }
  3640   3641   #ifndef NDEBUG
  3641   3642   static int winShmMutexHeld(void) {
  3642         -  return sqlite3_mutex_held(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1));
         3643  +  return sqlite3_mutex_held(winBigLock);
  3643   3644   }
  3644   3645   #endif
  3645   3646   
  3646   3647   /*
  3647   3648   ** Object used to represent a single file opened and mmapped to provide
  3648   3649   ** shared memory.  When multiple threads all reference the same
  3649   3650   ** log-summary, each thread has its own winFile object, but they all
................................................................................
  6058   6059   
  6059   6060     sqlite3_vfs_register(&winNolockVfs, 0);
  6060   6061   
  6061   6062   #if defined(SQLITE_WIN32_HAS_WIDE)
  6062   6063     sqlite3_vfs_register(&winLongPathNolockVfs, 0);
  6063   6064   #endif
  6064   6065   
         6066  +  winBigLock = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1);
  6065   6067     return SQLITE_OK;
  6066   6068   }
  6067   6069   
  6068   6070   int sqlite3_os_end(void){
  6069   6071   #if SQLITE_OS_WINRT
  6070   6072     if( sleepObj!=NULL ){
  6071   6073       osCloseHandle(sleepObj);
  6072   6074       sleepObj = NULL;
  6073   6075     }
  6074   6076   #endif
         6077  +  winBigLock = 0;
  6075   6078     return SQLITE_OK;
  6076   6079   }
  6077   6080   
  6078   6081   #endif /* SQLITE_OS_WIN */