UnQLite Users Forum

Multithreading for Linux


Hallo Chm,

I am reopening the thread to discuss about the Concurrent Write and Read operations on the database.

I have enabled the Multithreading.
1. In one thread I am trying to Store different data in the Database using an array of keys. I am doing a Database commit as soon as I store any data and also closing the database between 2 stores and reopening again for any fresh operations.

2. While the Store is ongoing after some time I start my 2nd thread which Tries to Retrieve the data from this database using the same keys. I am opening the database in another handle using UNQLITE_OPEN_READONLY attribute. Now the read should happen as the Retrieves are concurrently possible. But, still I get UNQLITE_BUSY which means the database reads are not concurrent even though I have enabled the multithreading. Am I going somewhere wrong??

I am using the unqlite_lib_is_threadsafe to check if multithreading is enabled and also making sure not to configure it as Single thread using Liunqlite_lib_config.

Sorry!! I did not provide any code sample. But, its just a serial Write and a Serial Read from 2 different threads.


(Leave this as-is, it’s a trap!)

Only the original author or a moderator can append to this post.

Pro tip: Use markup to add links, quotes and more.

Your friendly neighbourhood moderators: chm_at_symisc, devel_at_symisc