我有一个允许用户查询sqlite的应用程序。当应用程序启动时,它会下载一个URL,以查看后台线程上是否有任何数据库更新。
不幸的是,如果用户选择一个在更新运行时试图查询数据库的函数,则会导致锁发生。
我的问题有两个。
在这种情况下避免冲突的最佳策略是什么?.
- Copy the database to another file update it and copy back
- Have some sort of singleton operating and use it to schedule operations in a Queue.
- loop and wait for the