On Mon, Oct 04, 2010 at 02:17:06PM -0700, Dustin Sallings scratched on the wall:
> 
>       I've read the documentation, but one thing that was unclear:
> 
>       Do I need SQLITE_THREADSAFE=2 (or 1) when I am using sqlite
>    from two different threads entirely independently in a
>    single-threaded manner?

  Yes.  This statement seems fairly clear:

      When compiled with SQLITE_THREADSAFE=0 all mutexing code is
      omitted and it is unsafe to use SQLite in a multithreaded
      program.  <http://sqlite.org/compile.html#threadsafe>


  If you're treating the threads independently, each with their own
  database connections, you should be safe with =2 ("multithread"). 
  That provides less protection than =1 ("serialized"), but it is also
  faster.  Continued from above:

      When compiled with SQLITE_THREADSAFE=2, SQLite can be used in a
      multithreaded program so long as no two threads attempt to use
      the same database connection at the same time.


   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable." -- Angela Johnson
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to