SQLite

Check-in [fe441df9ba]
Login

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

Overview
Comment:Work around restriction in Windows file locking.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fe441df9ba447d97571e919099846efa3ec87427
User & Date: shaneh 2010-12-07 17:12:21.000
Context
2010-12-07
20:14
Version 3.7.4 (check-in: a586a4deeb user: drh tags: trunk, release, version-3.7.4)
17:12
Work around restriction in Windows file locking. (check-in: fe441df9ba user: shaneh tags: trunk)
16:39
Fix a bug in the demo "superlock" code preventing locks from being released in some circumstances. (check-in: 65c393793f user: dan tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
configure became a regular file.
install-sh became a regular file.
Changes to src/test_superlock.c.
147
148
149
150
151
152
153

154
155
156
157





158
159
160
161
162
163
164
147
148
149
150
151
152
153
154
155
156


157
158
159
160
161
162
163
164
165
166
167
168







+


-
-
+
+
+
+
+







** Release a superlock held on a database file. The argument passed to 
** this function must have been obtained from a successful call to
** sqlite3demo_superlock().
*/
void sqlite3demo_superunlock(void *pLock){
  Superlock *p = (Superlock *)pLock;
  if( p->bWal ){
    int rc;                         /* Return code */
    int flags = SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE;
    sqlite3_file *fd = 0;
    sqlite3_file_control(p->db, "main", SQLITE_FCNTL_FILE_POINTER, (void *)&fd);
    fd->pMethods->xShmLock(fd, 2, SQLITE_SHM_NLOCK-2, flags);
    rc = sqlite3_file_control(p->db, "main", SQLITE_FCNTL_FILE_POINTER, (void *)&fd);
    if( rc==SQLITE_OK ){
      fd->pMethods->xShmLock(fd, 2, 1, flags);
      fd->pMethods->xShmLock(fd, 3, SQLITE_SHM_NLOCK-3, flags);
    }
  }
  sqlite3_close(p->db);
  sqlite3_free(p);
}

/*
** Obtain a superlock on the database file identified by zPath, using the