/ Check-in [0c951a97]
Login

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

Overview
Comment:Omit an unnecessary Sleep() call in windows pending-lock retry logic. Enhance the comment on that logic to discourage people from copying it into other VFSes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0c951a970436725b6bbd64568de500f7a4e6460b
User & Date: drh 2011-11-09 18:07:34
Context
2011-11-10
20:21
In winAccess, save the Win32 last error value prior to invoking user logging callback. Also, explicitly pass the Win32 last error value to winLogError in order to keep it accurate. Fixes a problem reported on the mailing list. check-in: 32ab3657 user: mistachkin tags: trunk
2011-11-09
18:07
Omit an unnecessary Sleep() call in windows pending-lock retry logic. Enhance the comment on that logic to discourage people from copying it into other VFSes. check-in: 0c951a97 user: drh tags: trunk
2011-11-07
18:16
Make the unix VFS tolerant of read() calls that return less than the requested number of bytes. check-in: a210695a user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_win.c.

  1441   1441     newLocktype = pFile->locktype;
  1442   1442     if(   (pFile->locktype==NO_LOCK)
  1443   1443        || (   (locktype==EXCLUSIVE_LOCK)
  1444   1444            && (pFile->locktype==RESERVED_LOCK))
  1445   1445     ){
  1446   1446       int cnt = 3;
  1447   1447       while( cnt-->0 && (res = LockFile(pFile->h, PENDING_BYTE, 0, 1, 0))==0 ){
  1448         -      /* Try 3 times to get the pending lock.  The pending lock might be
  1449         -      ** held by another reader process who will release it momentarily.
         1448  +      /* Try 3 times to get the pending lock.  This is needed to work
         1449  +      ** around problems caused by anti-virus software on windows system.
         1450  +      ** If you are using this code as a model for alternative VFSes, do not
         1451  +      ** copy this retry logic.  It is a hack intended for windows only.
  1450   1452         */
  1451   1453         OSTRACE(("could not get a PENDING lock. cnt=%d\n", cnt));
  1452         -      Sleep(1);
         1454  +      if( cnt ) Sleep(1);
  1453   1455       }
  1454   1456       gotPendingLock = res;
  1455   1457       if( !res ){
  1456   1458         error = GetLastError();
  1457   1459       }
  1458   1460     }
  1459   1461