Re: [sqlite] transaction in one thread and other thread also trying to write data
It works best to have a connection per thread. On Tue, May 13, 2014 at 6:12 AM, d b wrote: > Hi all, > > >My application is multithreaded. It maintains only connection per > application. Database accessed by single process only. ThreadA will do > database write operations(bulk) in a transaction. ThreadB will do single > write operation without transaction but same connection pointer. > >Here, application needs to synchronize the calls among threads by using > synchronization technique(critical_section/mutex)? (OR) begin transaction > and commit will synchronize the calls between threads? > >Please suggest. > > Thanks, > av. > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] transaction in one thread and other thread also trying to write data
On 5/13/2014 9:12 AM, d b wrote: My application is multithreaded. It maintains only connection per application. Database accessed by single process only. ThreadA will do database write operations(bulk) in a transaction. ThreadB will do single write operation without transaction but same connection pointer. Transaction is a property of a connection, not a thread. If ThreadA started an explicit transaction on a connection, then writes by ThreadB on the same connection will also become part of that transaction. Here, application needs to synchronize the calls among threads by using synchronization technique(critical_section/mutex)? (OR) begin transaction and commit will synchronize the calls between threads? Individual sqlite3_* API calls on a given connection are serialized by SQLite: each call locks a mutex associated with the connection on entry, and unlocks it right before returning. If you need more synchronization than that, you would have to provide it yourself. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] transaction in one thread and other thread also trying to write data
On Tue, May 13, 2014 at 4:12 PM, d b wrote: >My application is multithreaded. It maintains only connection per > application. Database accessed by single process only. ThreadA will do > database write operations(bulk) in a transaction. ThreadB will do single > write operation without transaction but same connection pointer. > >Here, application needs to synchronize the calls among threads by using > synchronization technique(critical_section/mutex)? (OR) begin transaction > and commit will synchronize the calls between threads? > >Please suggest. > Please read this: http://www.sqlite.org/threadsafe.html ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] transaction in one thread and other thread also trying to write data
Hi all, My application is multithreaded. It maintains only connection per application. Database accessed by single process only. ThreadA will do database write operations(bulk) in a transaction. ThreadB will do single write operation without transaction but same connection pointer. Here, application needs to synchronize the calls among threads by using synchronization technique(critical_section/mutex)? (OR) begin transaction and commit will synchronize the calls between threads? Please suggest. Thanks, av. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users