Use short timeout for locking operations by default to be more in sync with the other platforms. (CVS 5119)
FossilOrigin-Name: d00a015dbcc5a7fc4aa7cb41f9740a712af510ae
This commit is contained in:
parent
8d4fc83817
commit
f19dfc4e0a
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C Correctly\stest\sDosWrite()\sfor\sfailure\sreturn\scode\s(CVS\s5118)
|
||||
D 2008-05-12T00:29:42
|
||||
C Use\sshort\stimeout\sfor\slocking\soperations\sby\sdefault\sto\sbe\smore\sin\ssync\swith\sthe\sother\splatforms.\s(CVS\s5119)
|
||||
D 2008-05-12T00:32:09
|
||||
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
|
||||
F Makefile.in 8b9b8263852f0217157f9042b8e3dae7427ec739
|
||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||
@ -118,7 +118,7 @@ F src/mutex_w32.c 133698096a2c4e81cd11ea6f4de7891c66f7b9f7
|
||||
F src/os.c f9708b7ebd902fe6969fee5660a71d50e0244cad
|
||||
F src/os.h 2ee8b0dec88f946c5371919ffa0f2fe4ac0de2e6
|
||||
F src/os_common.h e8b748b2f2ecc8a498e50bfe5d8721f189c19d2a
|
||||
F src/os_os2.c 6811c0b4ef1534490ab5d09d6e4ea4e62487e45e
|
||||
F src/os_os2.c 30d9357149a56e45da2440b7cd3b91aa3770009e
|
||||
F src/os_unix.c a810e2aefdaddacf479407f76f8f4ca381d231b2
|
||||
F src/os_win.c 3a60bddd07ea6f8adb2314dd5996ac97b988f403
|
||||
F src/pager.c c4e0bcb1f451d2b8601e1cf50e680d88bf175055
|
||||
@ -634,7 +634,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
|
||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
|
||||
P 88e12caca99d1d54cfe6228cb0de1eccc93fcc74
|
||||
R 0360d4f06e822f82395b4d67a9df1b75
|
||||
P 3eff0ef2cfe70389bc80a270902702206be178f3
|
||||
R b1a6d9dd6c243fc481c507726cbfc5f5
|
||||
U pweilbacher
|
||||
Z 0843eb395ea9d368c5a3784f071575b2
|
||||
Z bbb6661c7d1c5df1872673db954da30a
|
||||
|
@ -1 +1 @@
|
||||
3eff0ef2cfe70389bc80a270902702206be178f3
|
||||
d00a015dbcc5a7fc4aa7cb41f9740a712af510ae
|
37
src/os_os2.c
37
src/os_os2.c
@ -67,6 +67,8 @@ struct os2File {
|
||||
unsigned char locktype; /* Type of lock currently held on this file */
|
||||
};
|
||||
|
||||
#define LOCK_TIMEOUT 10L /* the default locking timeout */
|
||||
|
||||
/*****************************************************************************
|
||||
** The next group of routines implement the I/O methods specified
|
||||
** by the sqlite3_io_methods object.
|
||||
@ -225,7 +227,7 @@ static int getReadLock( os2File *pFile ){
|
||||
LockArea.lRange = SHARED_SIZE;
|
||||
UnlockArea.lOffset = 0L;
|
||||
UnlockArea.lRange = 0L;
|
||||
res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 1L );
|
||||
res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 1L );
|
||||
OSTRACE3( "GETREADLOCK %d res=%d\n", pFile->h, res );
|
||||
return res;
|
||||
}
|
||||
@ -243,7 +245,7 @@ static int unlockReadLock( os2File *id ){
|
||||
LockArea.lRange = 0L;
|
||||
UnlockArea.lOffset = SHARED_FIRST;
|
||||
UnlockArea.lRange = SHARED_SIZE;
|
||||
res = DosSetFileLocks( id->h, &UnlockArea, &LockArea, 2000L, 1L );
|
||||
res = DosSetFileLocks( id->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 1L );
|
||||
OSTRACE3( "UNLOCK-READLOCK file handle=%d res=%d?\n", id->h, res );
|
||||
return res;
|
||||
}
|
||||
@ -310,23 +312,14 @@ int os2Lock( sqlite3_file *id, int locktype ){
|
||||
if( pFile->locktype==NO_LOCK
|
||||
|| (locktype==EXCLUSIVE_LOCK && pFile->locktype==RESERVED_LOCK)
|
||||
){
|
||||
int cnt = 3;
|
||||
|
||||
LockArea.lOffset = PENDING_BYTE;
|
||||
LockArea.lRange = 1L;
|
||||
UnlockArea.lOffset = 0L;
|
||||
UnlockArea.lRange = 0L;
|
||||
|
||||
while( cnt-->0 && ( res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 0L ) )
|
||||
!= NO_ERROR
|
||||
){
|
||||
/* Try 3 times to get the pending lock. The pending lock might be
|
||||
** held by another reader process who will release it momentarily.
|
||||
*/
|
||||
OSTRACE2( "LOCK could not get a PENDING lock. cnt=%d\n", cnt );
|
||||
DosSleep(1);
|
||||
}
|
||||
if( res == NO_ERROR){
|
||||
/* wait longer than LOCK_TIMEOUT here not to have to try multiple times */
|
||||
res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 100L, 0L );
|
||||
if( res == NO_ERROR ){
|
||||
gotPendingLock = 1;
|
||||
OSTRACE3( "LOCK %d pending lock boolean set. res=%d\n", pFile->h, res );
|
||||
}
|
||||
@ -351,7 +344,7 @@ int os2Lock( sqlite3_file *id, int locktype ){
|
||||
LockArea.lRange = 1L;
|
||||
UnlockArea.lOffset = 0L;
|
||||
UnlockArea.lRange = 0L;
|
||||
res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 0L );
|
||||
res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
|
||||
if( res == NO_ERROR ){
|
||||
newLocktype = RESERVED_LOCK;
|
||||
}
|
||||
@ -376,7 +369,7 @@ int os2Lock( sqlite3_file *id, int locktype ){
|
||||
LockArea.lRange = SHARED_SIZE;
|
||||
UnlockArea.lOffset = 0L;
|
||||
UnlockArea.lRange = 0L;
|
||||
res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 0L );
|
||||
res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
|
||||
if( res == NO_ERROR ){
|
||||
newLocktype = EXCLUSIVE_LOCK;
|
||||
}else{
|
||||
@ -395,7 +388,7 @@ int os2Lock( sqlite3_file *id, int locktype ){
|
||||
LockArea.lRange = 0L;
|
||||
UnlockArea.lOffset = PENDING_BYTE;
|
||||
UnlockArea.lRange = 1L;
|
||||
r = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 0L );
|
||||
r = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
|
||||
OSTRACE3( "LOCK %d unlocking pending/is shared. r=%d\n", pFile->h, r );
|
||||
}
|
||||
|
||||
@ -436,7 +429,7 @@ int os2CheckReservedLock( sqlite3_file *id ){
|
||||
LockArea.lRange = 1L;
|
||||
UnlockArea.lOffset = 0L;
|
||||
UnlockArea.lRange = 0L;
|
||||
rc = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 0L );
|
||||
rc = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
|
||||
OSTRACE3( "TEST WR-LOCK %d lock reserved byte rc=%d\n", pFile->h, rc );
|
||||
if( rc == NO_ERROR ){
|
||||
APIRET rcu = NO_ERROR; /* return code for unlocking */
|
||||
@ -444,7 +437,7 @@ int os2CheckReservedLock( sqlite3_file *id ){
|
||||
LockArea.lRange = 0L;
|
||||
UnlockArea.lOffset = RESERVED_BYTE;
|
||||
UnlockArea.lRange = 1L;
|
||||
rcu = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 0L );
|
||||
rcu = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
|
||||
OSTRACE3( "TEST WR-LOCK %d unlock reserved byte r=%d\n", pFile->h, rcu );
|
||||
}
|
||||
r = !(rc == NO_ERROR);
|
||||
@ -482,7 +475,7 @@ int os2Unlock( sqlite3_file *id, int locktype ){
|
||||
LockArea.lRange = 0L;
|
||||
UnlockArea.lOffset = SHARED_FIRST;
|
||||
UnlockArea.lRange = SHARED_SIZE;
|
||||
res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 0L );
|
||||
res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
|
||||
OSTRACE3( "UNLOCK %d exclusive lock res=%d\n", pFile->h, res );
|
||||
if( locktype==SHARED_LOCK && getReadLock(pFile) != NO_ERROR ){
|
||||
/* This should never happen. We should always be able to
|
||||
@ -496,7 +489,7 @@ int os2Unlock( sqlite3_file *id, int locktype ){
|
||||
LockArea.lRange = 0L;
|
||||
UnlockArea.lOffset = RESERVED_BYTE;
|
||||
UnlockArea.lRange = 1L;
|
||||
res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 0L );
|
||||
res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
|
||||
OSTRACE3( "UNLOCK %d reserved res=%d\n", pFile->h, res );
|
||||
}
|
||||
if( locktype==NO_LOCK && type>=SHARED_LOCK ){
|
||||
@ -508,7 +501,7 @@ int os2Unlock( sqlite3_file *id, int locktype ){
|
||||
LockArea.lRange = 0L;
|
||||
UnlockArea.lOffset = PENDING_BYTE;
|
||||
UnlockArea.lRange = 1L;
|
||||
res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 0L );
|
||||
res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
|
||||
OSTRACE3( "UNLOCK %d pending res=%d\n", pFile->h, res );
|
||||
}
|
||||
pFile->locktype = locktype;
|
||||
|
Loading…
Reference in New Issue
Block a user