SQLite is to support multi-threaded operation, the need to initialize the database is to do a thread-safe config, refer to the following links, looks more complex.
Http://www.cnblogs.com/wfwenchao/p/3964213.html
Many iOS projects use Fmdb, a third-party open Source Library, but Fmdb cannot co-fmdatabase objects in multiple threads, because the class itself is not thread-safe, and if such use causes problems such as data confusion.
If you need to operate a database with multiple threads, you need to use Fmdatabasequeue to ensure thread safety.
First the fmdatabasequeue is initialized with a database file address, and then a closure (block) can be passed into the Indatabase method. Operate the database in a closure without directly participating in the management of the fmdatabase.
Fmdatabasequeue to solve this problem is to create a queue, and then put into the queue block sequence execution, so as to avoid multi-threaded simultaneous access to the database;
If it is multi-threaded to create fmdatabasequeue instances, in fact there are multiple queues, or there is a problem of database competition, and the same as when using Fmdatabase;
Let each thread use the same queue instance, the problem is solved successfully;
Reference:
1) http://blog.csdn.net/kyfxbl/article/details/38123239
2) http://blog.devtang.com/blog/2012/04/22/use-fmdb/
IOS Database multithreaded Operations