"Salles, Joaquim Campos" <[EMAIL PROTECTED]> wrote:
> Hello,
> 
> Is safe to use the same database connection  at the same time in more
> than one thread? The bellow like that is safe: 
> 
> http://www.sqlite.org/34to35.html
> 
> "Restrictions on the use of the same database connection by multiple
> threads have been dropped. It is now safe for multiple threads to use
> the same database connection at the same time."
> 
> But in following URL say:
> 
> http://www.sqlite.org/cvstrac/wiki?p=MultiThreading
> 
> "Do not use the same database connection at the same time in more than
> one thread."
> 
> 
> So, for SQlite 3.5.* is safe to use the same database connection at the
> same time in more than one thread?
> 

Yes.  The wiki page was correct when written but that was
prior to the release of version 3.5.0.

Note that SQLite uses mutexes internally so what will really
happen is one thread will block while the other is using the
database connection.  Access to database connections is serialized.
But the application code does not need to concern itself with
the serialization any more.  That is now handled automatically
by SQLite.

It is also my duty to earnestly warn programmers of all ilks
that multi-threaded programming is madness.  Multi-threading
causes programs to run slower, have more bugs, and become harder
to maintain.  Threads are deadly.  Avoid them.

--
D. Richard Hipp <[EMAIL PROTECTED]>



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to