Sharma, Gaurav wrote:
> Is there any way through which without using the mutex lock mechanism
> multiple threads can perform INSERT in bulk on same memory db. What I
> assume is if I share an in memory db connection handle across threads
> then it will not be sqlite's responsibility but the user's
> responsibility to protect multiple insert/update statements. On the
> other hand if the connection to physical db is shared amongst threads
> then sqlite takes care of synchronization between multiple
> insert/update from multiple threads.

I don't believe this is the case. The locking behavior should be the 
same for in-memory and on-disk databases. The exact behavior is 
described here: http://www.sqlite.org/threadsafe.html

> Basically a broader question is that, Is there any way to avoid
> sharing of connection handle and even then be able to work on the
> same memory db from multiple threads.

No.

> I really wish to avoid the
> burden of using mutex for every (insert or update) in multi threaded
> scenario.

You don't have to, SQLite will do that for you.

> That actually supposed to put lot of overhead on my
> application.

If you mean performance overhead, then I don't see how you can avoid 
that. You are working on a shared data structure - someone somewhere 
must synchronize access to avoid races, whether your code or SQLite 
itself.

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to