I'm using a shared database (by using RDbNamedDatabase) that can be accessed for read and/or write from multiple threads. I looked over the documentation about using shared database with DBMS, but something is still missing to me to fully understand it: while it's possible to gain a read lock (by RDbDatabase::Begin()), the write-lock is gained automatically and if one (or more) of the clients have read-lock, the write operation is failed. My questions are:
- How can I check in advance whether the database is read-locked? do I have to wait to a failure?
- Is there a way to wait for all the read-locks to be released, or it should be implemented by the application logic.
Any insight about the best way to handle this correctly will be appreciated :-)