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?

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?

Marc

-----Original Message-----
From: [email protected] [mailto:[email protected]] 
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
<[email protected]>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
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



--
D. Richard Hipp
[email protected]
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to