Understood. I want to more sure of the following assumptions:

1. Trivial fucntions such as sqlite3_close, sqite3_errcode also need mutex 
protection even they seem so simple.
2. Fuctions that do not use sqlite3* and sqite3_stmt* such as sqlite3_mprintf 
do not need mutex protection.

Thanks.

----------------------------------------
> From: d...@sqlite.org
> Date: Thu, 4 Sep 2014 10:07:02 -0400
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] SQLITE_THREADSAFE question
>
> On Thu, Sep 4, 2014 at 9:59 AM, Neo Anderson <neo_in_mat...@msn.com> wrote:
>
>> I'm building a custom library wrapper for Cocoa. I want to handle database
>> threading issue myself.
>>
>> From http://sqlite.org/compile.html#threadsafe:
>>
>> [quote]
>> When compiled with SQLITE_THREADSAFE=2, SQLite can be used in a
>> multithreaded program so long as no two threads attempt to use the
>> same database connection (or any prepared statements derived from that
>> database connection) at the same time.
>> [/quote]
>>
>> I have two questions:
>>
>> 1. Does SQLITE_THREADSAFE only and solely affects struct sqlite3* and
>> sqlite3_stmt* related API calls?
>>
>
> The difference between SQLITE_THREADSAFE=1 and SQLITE_THREADSAFE=2 is only
> for sqlite3 and sqlite3_stmt related API calls. But SQLITE_THREADSAFE=0
> affects *all* APIs.
>
>
>
>> 2. Are sqlite3_config(SQLITE_CONFIG_MULTITHREAD) and SQLITE_OPEN_NOMUTEX
>> does the same thing as SQLITE_THREADSAFE=2 define?
>>
>
> Yes, as long as you do not compile with SQLITE_THREADSAFE=0. When you
> compilewith SQLITE_THREADSAFE=0, all mutex logic is omitting from the
> build, and so you can never, ever, safely use the resulting library in a
> multi-threaded program, regardless of how you open your connections.
>
>
>>
>>
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>
>
>
> --
> D. Richard Hipp
> d...@sqlite.org
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
                                          
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to