Re: [sqlite] Using sqlite3 from multiple threads

2008-01-11 Thread Ken
You have to write the non-busy wait handlers yourself. As an example the thread that has acquired the DB and has performed its writes. At the time it commits it could post a condition variable/mutex pair. Any thread that gets a busy could simply undo its work, and wait on the condition

Re: [sqlite] Using sqlite3 from multiple threads

2008-01-11 Thread John Stanton
I find it much simpler to put a mutex around the accesses (or make them a critical section). That serializes the access and avoids busy waits, retries etc. It will prevent a certain amount of read concurrency. but that may be insignificant. If you use pthreads and have plenty of reads for

Re: [sqlite] Using sqlite3 from multiple threads

2008-01-11 Thread Andreas Volz
Am Wed, 9 Jan 2008 10:20:31 -0800 (PST) schrieb Ken: > Definately use 3.5.4. > > Not sure how to determine at compile time if the threadsafe part is > enabled. You can always compile yourself to guarantee its set, thats > what I do. > > sqlite will lock the database file for you automatically.

Re: [sqlite] Using sqlite3 from multiple threads

2008-01-09 Thread Nicolas Williams
On Wed, Jan 09, 2008 at 10:06:30PM +, [EMAIL PROTECTED] wrote: > Nicolas Williams <[EMAIL PROTECTED]> wrote: > > Would you recommend that we not make SQLite 3.x in Solaris available to > > third parties? > > I think having a libsqlite3.so available is great. There will likely > be smaller

Re: [sqlite] Using sqlite3 from multiple threads

2008-01-09 Thread drh
Andreas Volz <[EMAIL PROTECTED]> wrote: > > I don't understand how to use the sqlite3_io_methods. It seems I need a > sqlite3_file. Not sure I get it from the API. The sqlite3_open call > returns an int. So how do I use this? > > Perhaps you could sketch some pseudo code or paste some code where

Re: [sqlite] Using sqlite3 from multiple threads

2008-01-09 Thread drh
Nicolas Williams <[EMAIL PROTECTED]> wrote: > On Wed, Jan 09, 2008 at 09:03:51PM +, [EMAIL PROTECTED] wrote: > > In fact, the only company > > I know of that makes use of shared libraries for SQLite is Apple. > > Solaris will be shipping SQLite 3.x as a

Re: [sqlite] Using sqlite3 from multiple threads

2008-01-09 Thread Andreas Volz
Am Wed, 9 Jan 2008 10:20:31 -0800 (PST) schrieb Ken: > Definately use 3.5.4. > > Not sure how to determine at compile time if the threadsafe part is > enabled. You can always compile yourself to guarantee its set, thats > what I do. > > sqlite will lock the database file for you automatically.

Re: [sqlite] Using sqlite3 from multiple threads

2008-01-09 Thread Nicolas Williams
On Wed, Jan 09, 2008 at 09:03:51PM +, [EMAIL PROTECTED] wrote: > In fact, the only company > I know of that makes use of shared libraries for SQLite is Apple. Solaris will be shipping SQLite 3.x as a shared library. > They can get away with this because

Re: [sqlite] Using sqlite3 from multiple threads

2008-01-09 Thread drh
Andreas Volz <[EMAIL PROTECTED]> wrote: > > The reason is that I had some bad luck integrating applications into > Gentoo that include dependency sources. The Linux (here: Gentoo) way is > to have shared objects of all dependencies and the ability to let all > applications automatic benefit from

Re: [sqlite] Using sqlite3 from multiple threads

2008-01-09 Thread Andreas Volz
Am Wed, 09 Jan 2008 18:17:55 + schrieb [EMAIL PROTECTED]: > Andreas Volz <[EMAIL PROTECTED]> wrote: > > > > I've only 3.4.1 installed. But Gentoo has 3.5.4 in the unstable > > tree. I'll install that one if needed. > > > > I see this idea expressed often, Andreas. Please help me to >

Re: [sqlite] Using sqlite3 from multiple threads

2008-01-09 Thread Daniel Önnerby
[EMAIL PROTECTED] wrote: I see this idea expressed often, Andreas. Please help me to understand how I can improve the SQLite website or documentation to make it clear that SQLite does *not* need to be "installed"? I think the sqlite.org make this very clear, but people just can't believe

Re: [sqlite] Using sqlite3 from multiple threads

2008-01-09 Thread Ken
Definately use 3.5.4. Not sure how to determine at compile time if the threadsafe part is enabled. You can always compile yourself to guarantee its set, thats what I do. sqlite will lock the database file for you automatically. Your threads do not need to implement locking. But they do need to

Re: [sqlite] Using sqlite3 from multiple threads

2008-01-09 Thread drh
Andreas Volz <[EMAIL PROTECTED]> wrote: > > I've only 3.4.1 installed. But Gentoo has 3.5.4 in the unstable tree. > I'll install that one if needed. > I see this idea expressed often, Andreas. Please help me to understand how I can improve the SQLite website or documentation to make it clear

Re: [sqlite] Using sqlite3 from multiple threads

2008-01-09 Thread Andreas Volz
Am Wed, 9 Jan 2008 09:03:35 -0800 (PST) schrieb Ken: > Andears, > > SQLITE 3.5.x is thread safe when configured and compiled with > --enable-threadsafe. I've only 3.4.1 installed. But Gentoo has 3.5.4 in the unstable tree. I'll install that one if needed. And is it possible to find out at

Re: [sqlite] Using sqlite3 from multiple threads

2008-01-09 Thread Ken
Andears, SQLITE 3.5.x is thread safe when configured and compiled with --enable-threadsafe. You can create multiple db connections to a single database. But only one connection will be allowed to write to the Database at a time. Take a look at http://www.sqlite.org/lockingv3.html

[sqlite] Using sqlite3 from multiple threads

2008-01-09 Thread Andreas Volz
Hello, I like to use sqlite3 from a multi-threaded application. The situation is that I've several threads that like to write into a single DB file and into the same table. I read something about sqlite is thread save. But I'm not sure how much. Is it allowed to open the DB file and table