On Tue, Feb 7, 2012 at 3:13 PM, Marc L. Allen <mlal...@outsitenetworks.com>wrote:
> Ok. I can do that. Do I need to keep track of where each pseudo-file > open is at, or does sqlite always seek on a file before reading/writing? > The methods on the VFS open-file object<http://www.sqlite.org/c3ref/io_methods.html>that do reading and writing specify both the amount and the offset. There are no seeks. > > Also, do the VFS xLock, etc. functions need to affect the opening or > closing of files? That is, if sqlite requests a PENDING or EXCLUSIVE lock > on a file and another thread wants to open a connection, do I deny the > xOpen call? Or allow the open to succeed, assuming that the future > xLock(SHARED) will handle it? > The open succeeds. xLock() does not interact with any other VFS calls other than itself and xUnlock and xCheckReservedLock. Locking is purely advisory. > > Marc > > -----Original Message----- > From: sqlite-users-boun...@sqlite.org [mailto: > sqlite-users-boun...@sqlite.org] On Behalf Of Richard Hipp > Sent: Tuesday, February 07, 2012 3:09 PM > To: General Discussion of SQLite Database > Subject: Re: [sqlite] File locking requirements in Single > Process/Multi-Threaded system > > On Tue, Feb 7, 2012 at 2:42 PM, Marc L. Allen > <mlal...@outsitenetworks.com>wrote: > > > I'm trying to use sqlite in an embedded, multi-tasking system with a > > very simple file system. Essentially, it doesn't support having a file > open > > multiple times. That is, only one reader or writer. > > > > I have studied the code, but I can't quite tell how sqlite manages the > > DB files in a single process, multi-threaded environment. > > > > I would like to avoid funneling all DB requests through a single > > thread, and maximize concurrency by allowing multiple threads to > > access the DB at will. I have some threads that might be doing > > relatively long read operations and really don't want to inhibit the > occasional writes. > > > > Is this possible? Or is OS level file sharing a firm requirement for > > multi-threaded operation? > > > > The VFSes for unix and windows both open a separate file descriptor for > each database connection. But there is no requirement to do this. For the > custom VFS that you have to write to interface to your "very simple file > system" you can have all database connections share the same open file > connection. > > > > > > Thanks, > > > > Marc > > > > _______________________________________________ > > sqlite-users mailing list > > sqlite-users@sqlite.org > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > > > > > -- > D. Richard Hipp > d...@sqlite.org > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users