On Wed, Jan 8, 2020 at 7:10 AM Dan Kennedy <danielk1...@gmail.com> wrote:

>
> On 8/1/63 20:29, J Decker wrote:
> > The documentation isn't very clear on what the intent of an xUnlock(
> > SQLITE_LOCK_NONE ) is intended to do.  Is it unlock everything? Is it the
> > same as remove a shared lock?
>
> That's right. xUnlock(fd, SQLITE_LOCK_NONE) should completely unlock the
> file. xUnlock(fd, SQLITE_LOCK_SHARED) should fall back to a SHARED lock
> from RESERVED/PENDING/EXCLUSIVE.
>
> Thank you... the second thing there confuses me...
xLock(SHARED)  xLock(SHARED) xLock(PENDING)
xUnlock( SHARED) - clear pending, and add a shared for total of 3?  or is
xUnlock always remove (this file handle's) locks?
I haven't finished implementing the first part to get a 'real' sequence...
Also; I suppose I should return SQLITE_BUSY instead of waiting on the lock
myself?  expected return values aren't covered well either.

Dan.
>
>
>
> >
> > The first few operations are xLock( SQLITE_LOCK_SHARED ) followed by
> > xUnlock(SQLITE_LOCK_NONE)...
> >
> > sqlite.h.in
> > https://github.com/mackyle/sqlite/blob/master/src/sqlite.h.in#L627
> > where the constants are defined... says 'one of these are used...'
> >
> > and describing locking levels...
> > https://github.com/mackyle/sqlite/blob/master/src/sqlite.h.in#L708-L720
> >
> >
> > https://www.sqlite.org/c3ref/io_methods.html
> > xLock() increases the lock. xUnlock() decreases the lock. The
> > xCheckReservedLock() method checks whether any database connection,
> either
> > in this process or in some other process, is holding a RESERVED, PENDING,
> > or EXCLUSIVE lock on the file. It returns true if such a lock exists and
> > false otherwise.
> >
> > https://www.sqlite.org/lockingv3.html
> > has description of what locking states are intended to be... there's
> > 'UNLOCKED' but not LOCK_NONE
> >
> > I did find another page that had lock state transitions, and information
> > about when the busy callback would be called... but that also didn't say
> > anything about the transition to unlock states...
> >
> > There was a note around the .C code in the pager unlocking using
> LOCK_NONE,
> > but I cna't find that, it just says, see note above... and that didn't
> > really say what the intent was.
> >
> > I searched the nabble mailing list archive for 'SQLITE_LOCK_NONE' and
> found
> > 0 hits.
> > _______________________________________________
> > sqlite-users mailing list
> > sqlite-users@mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to