SQLite

Check-in [0c951a9704]
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
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0c951a970436725b6bbd64568de500f7a4e6460b
User & Date: drh 2011-11-09 18:07:34.181
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: 32ab365715 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: 0c951a9704 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: a210695abc user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/os_win.c.
1441
1442
1443
1444
1445
1446
1447
1448
1449


1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
  newLocktype = pFile->locktype;
  if(   (pFile->locktype==NO_LOCK)
     || (   (locktype==EXCLUSIVE_LOCK)
         && (pFile->locktype==RESERVED_LOCK))
  ){
    int cnt = 3;
    while( cnt-->0 && (res = LockFile(pFile->h, PENDING_BYTE, 0, 1, 0))==0 ){
      /* Try 3 times to get the pending lock.  The pending lock might be
      ** held by another reader process who will release it momentarily.


      */
      OSTRACE(("could not get a PENDING lock. cnt=%d\n", cnt));
      Sleep(1);
    }
    gotPendingLock = res;
    if( !res ){
      error = GetLastError();
    }
  }








|
|
>
>


|







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