/ Check-in [5a384be6]
Login

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

Overview
Comment:Avoid superfluous SHM unlock call in the Win32 VFS.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | readonly-wal-recovery
Files: files | file ages | folders
SHA3-256: 5a384be6979b783d1f3af2ac6307e7e731c415d052f9405f04c0216f59414633
User & Date: mistachkin 2017-11-09 23:24:29
Context
2017-11-10
20:00
Improved comments and variable names in the read-only WAL logic. check-in: d3c25740 user: drh tags: readonly-wal-recovery
2017-11-09
23:24
Avoid superfluous SHM unlock call in the Win32 VFS. check-in: 5a384be6 user: mistachkin tags: readonly-wal-recovery
22:25
Cleanup superfluous whitespace changes. check-in: a2908e2c user: mistachkin tags: readonly-wal-recovery
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_win.c.

  3830   3830   **
  3831   3831   ** If the DMS cannot be locked because this is a readonly_shm=1
  3832   3832   ** connection and no other process already holds a lock, return
  3833   3833   ** SQLITE_READONLY_CANTINIT and set pShmNode->isUnlocked=1.
  3834   3834   */
  3835   3835   static int winLockSharedMemory(winShmNode *pShmNode){
  3836   3836     int rc = winShmSystemLock(pShmNode, WINSHM_WRLCK, WIN_SHM_DMS, 1);
         3837  +
  3837   3838     if( rc==SQLITE_OK ){
  3838   3839       if( pShmNode->isReadonly ){
  3839   3840         pShmNode->isUnlocked = 1;
  3840   3841         winShmSystemLock(pShmNode, WINSHM_UNLCK, WIN_SHM_DMS, 1);
  3841   3842         return SQLITE_READONLY_CANTINIT;
  3842   3843       }else if( winTruncate((sqlite3_file*)&pShmNode->hFile, 0) ){
  3843   3844         winShmSystemLock(pShmNode, WINSHM_UNLCK, WIN_SHM_DMS, 1);
  3844   3845         return winLogError(SQLITE_IOERR_SHMOPEN, osGetLastError(),
  3845   3846                            "winLockSharedMemory", pShmNode->zFilename);
  3846   3847       }
  3847   3848     }
  3848   3849   
  3849         -  winShmSystemLock(pShmNode, WINSHM_UNLCK, WIN_SHM_DMS, 1);
         3850  +  if( rc==SQLITE_OK ){
         3851  +    winShmSystemLock(pShmNode, WINSHM_UNLCK, WIN_SHM_DMS, 1);
         3852  +  }
         3853  +
  3850   3854     return winShmSystemLock(pShmNode, WINSHM_RDLCK, WIN_SHM_DMS, 1);
  3851   3855   }
  3852   3856   
  3853   3857   /*
  3854   3858   ** Open the shared-memory area associated with database file pDbFd.
  3855   3859   **
  3856   3860   ** When opening a new shared-memory file, if no other instances of that