Jay Sprenkle uttered:

On 1/21/07, Andrew Teirney <[EMAIL PROTECTED]> wrote:
>
> > What is a 'shared' lock? You can't share a lock, only one process > > can own it at a time.
> >
>
> As per this document
>
> http://www.sqlite.org/lockingv3.html
>
> SHARED The database may be read but not written. Any number of > processes can hold SHARED locks at the same time, hence there can be > many simultaneous readers. But no other thread or process is allowed > to write to the database file while one or more SHARED locks are > active.
>

A file lock is used to serialize write access. When reading the file is not locked. This makes little sense. There are no 'shared' locks.
Sorry, Accidently hit send before I was finished. This documentation needs to be updated so it makes sense. Making up this conceptual 'shared lock' thing instead of explaining how the locking mechanism really works is not helpful. A 'shared lock' in reality is just opening the disk file that makes up the database without locking. Any number of other processes can read the file. You can't acquire a shared lock, you just don't acquire a write lock.


No, you do acquire a lock. You must lock out any writer, but you do not require locking out other readers, hence you can share the lock with other readers, but it is a lock. It is a conceptual lock, and an OS level lock.

Without the shared lock, the writer would have no way of knowing whether any other process is reading the file, thus making it unsafe to change the file.

Christian



--
    /"\
    \ /    ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
     X                           - AGAINST MS ATTACHMENTS
    / \

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to