Reputation: 902
Let's say a CoreData stack is configured to use Sqlite as a persistence mechanism.
As I understand neither ManagedObject no ManagedObjectContextinstances are thread safe. What about PersistentStoreManager, is it thread safe?
In other words, should I implement some kind of synchronization solution if I have multiple threads reading and writing into the same persistent core data store?
Upvotes: 1
Views: 64
Reputation: 180868
Like most database systems, SQLite implements its own concurrency mechanisms to resolve thread/user conflicts. So no, you don't need to roll your own.
That said, SQLite is not ideal if you're going to have a lot of write contention. SQLite locks the entire database during writes, so you should try and minimize the amount of concurrent writing that takes place.
More on SQLite concurrency can be found here:
http://www.sqlite.org/lockingv3.html
Upvotes: 1