denys
denys

Reputation: 2529

Is sqlite.swift threadsafe?

Is it possible to use sqlite.swift from multiple threads (read/write same table). I tried to determine it from from build setting - but did not found SERIALIZED, MULTITHREAD or THREADSAFE words.
Does it use original sqlite3 C library under the hood?

Upvotes: 1

Views: 1063

Answers (1)

CL.
CL.

Reputation: 180172

The default for the SQLITE_THREADSAFE option is "serialized".

However, accessing the same database connection from multiple threads is likely to blow up because there is only one transaction per connection. You should use one connection per thread anyway.

Upvotes: 2

Related Questions