SQLite Forum

Dispatch Sqlite Instance with event loop
Login
If I understand your intended usage correctly, it is safe with SQLITE_THREADSAFE=2.  The SQLite library does not use thread-local storage or anything else which would cause it to work differently when a connection is passed from one thread to another at a time when no locks are held on behalf of the thread, a condition that certainly holds when no calls into the library are active. And as long as the work to be done is complete (as defined below) when the connection passes between threads, no other misbehavior, undefined behavior, or resource leakage will occur.

The "work to be done is complete" state means: No prepared statement exists (because the ones created have been finalized); and all explicit and implicit allocations due to be given to sqlite3_free() have been so handled. The former condition necessarily means no transactions can be open. (They are rolled back if still open at statement finalization.)