b.bum wrote:
Some more locking questions...

When sqlite3OsLock() takes out the PENDING lock, it switches between RDLOCK and WRLOCK depending on the locktype requested.

However, it doesn't appear that any subsequent code checks for RDLOCK vs.WRLOCK on the PENDING BYTE. Actually, it appears that the only GETLK test is against the RESERVED byte. Where is PENDING ever tested for on the actual file?



When a process tries for a SHARED lock, it first gets a a RDLOCK on the PENDING_BYTE. It releases that RDLOCK after the (separate) RDLOCK is obtained on the appropriate byte(s) in the shared lock region.

When a process gets a PENDING lock, it gets a WRLOCK on the PENDING_BYTE
and holds it until the PENDING lock is released.

The WRLOCK on the PENDING_BYTE prevents new SHARED locks from being
acquired while the PENDING lock is held.  This is designed to prevent
(or at least limit) writer starvation.

--
D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565



Reply via email to