Webastor - Programming Tips and Tricks

General Category => General Discussion => Topic started by: Isaiah on March 05, 2015, 08:39:50 AM

Title: Sqlite thread safe?
Post by: Isaiah on March 05, 2015, 08:39:50 AM
Hello, I would like to submit a question, I hope you can answer me, sqlite thread safe Please answer the Help question.
Title: Re: Sqlite thread safe
Post by: Rob Lucci on October 30, 2017, 09:09:39 PM
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.

The threading mode can be selected at compile-time (when the SQLite library is being compiled from source code) or at start-time (when the application that intends to use SQLite is initializing) or at run-time (when a new SQLite database connection is being created). Generally speaking, run-time overrides start-time and start-time overrides compile-time. Except, single-thread mode cannot be overridden once selected.

The default mode is serialized.