On Sunday, 11 August, 2019 10:31, test user <example.com.use...@gmail.com> 
wrote:

>By FFI I mean any of the public SQLite C functions exported from via
>FFI.

>Ok thanks, this makes sense the error callback is called whilst
>SQLite is executing exec/step.

>Do I need on callback per thread?

No, the callback configuration is per process (the callback address is stored 
in per process data).

That said, the callback is executed synchronously inline by the sqlite3 code 
detecting the error, so the callback function is executed on whatever thread 
encountered the error.  You cannot receive multiple simultaneous callbacks on 
the same thread (since one thread can only execute one instruction at a time).

I do not see anything in the sqlite3_log code which would serialize callbacks 
per process.  This means that you may, in a multithreaded program where 
multiple threads are active in the sqlite3 library code simultaneously (such as 
one connection per thread), receive callbacks simultaneously on multiple 
threads.  This means that if your implementation or the callback function 
manipulates per process data, that data will have to be protected against 
concurrent mutation by multiple threads.

>On Sun, Aug 11, 2019 at 4:31 PM Clemens Ladisch <clem...@ladisch.de>
>wrote:
>
>> test user wrote:
>> > The error log takes a callback which is called when an error
>occurs from
>> > any SQLite FFI function:
>>
>> What exactly do you mean with "FFI"?  You did not mention any other
>> language.
>>
>> > How does this interrupt my program whilst its running?
>>
>> As a library, SQLite is part of your program.  It just calls the
>callback
>> while sqlite3_exec()/sqlite3_step() etc. is being executed.



-- 
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.




_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to