I have an iOS app that uses sqlite3 and I\'m facing issues with multi-threading crashing the app with the illegal multi-threaded access to database connec
From https://www.sqlite.org/threadsafe.html
SQLite supports three different threading modes:
Single-thread. In this mode, all mutexes are disabled and SQLite is unsafe to use in more than a single thread at once.
Multi-thread. In this mode, SQLite can be safely used by multiple threads provided that no single database connection is used simultaneously in two or more threads.
Serialized. In serialized mode, SQLite can be safely used by multiple threads with no restriction.
In iOS,SQLite default threading mode was SQLITE_OPEN_NOMUTEX(equal to Multi-thread),which was not safe when multiple threads write or read the database simultaneously use one connection.
Change threading mode to serialized may helpful for you.You can change threading mode use sqlite3_config() or sqlite3_open_v2().