At 11:17 01/06/2007, you wrote: >Hi, > >I am having a scenario where I have one reader/writer and many writer threads. >All writers are pretty basic (single INSERT INTO; some sort of a logging info >what a thread has done). > >I believe I will receive many BUSY return codes and I don't like these >spinlock-like retries. The problem I am having with this design is that I would >like to complete the thread ASAP, so that I don't have many threads idling and >consuming resources of my embedded system. > >I was thinking to either: > >a. Use mutex/semaphore before writting to the database or > >b. Have a (thread safe) list of INSERT INTO strings that every writer thread >populates and the main reader/writer thread later executes. > >Is this a good approach? Does anyone have a better design? I don't want to use >other database, because I think Sqlite is great for an embedded system that I >am using.
How many threads have you?. If threads number is low (less than 29) you can use a database for each thread. Each one will have it's own file and no write lock problems. From time to time a simple sql query can get all data from those databases, write to the main one and delete the databases. HTH ------------------------------------------------------------------------------------------------------------ Usuario de FreeBSD+Xfce, OpenOffice y muchos mas OSS. Microsoft declara que el OSS viola 235 patentes. Por favor, DENUNCIAME. ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------