Android sqlite concurrency without exceptions

后端 未结 2 1485
你的背包
你的背包 2020-12-11 02:47

Sqlite on android lets you access the database from multiple procs for reads, but if you\'re currently writing from one process, reads and writes from other procs will throw

2条回答
  •  执笔经年
    2020-12-11 03:16

    So long as you're using the same SQLiteDatabase object, the synchronisation is done for you.

    So if you access the object via a singleton, there should be no problem. Though you may want to add some further logic if you want to implement a timeout, e.g. wait/notify or something similar.

提交回复
热议问题