On Tue, Nov 12, 2013 at 7:38 PM, Richard Hipp <[email protected]> wrote:
> SQLite serializes callbacks to extension objects originating from a > single > database connection. But if you have multiple database connections running > in separate threads, then the same callback might be invoked simultaneously > from multiple threads. You'll need to serialize access to your private > data structures yourself. > Maybe I wasn't clear enough, let me elaborate a little. >From what I understand, sqlite3_extension_init() is called once for each new database connection. In this entry point my extension library creates instances of the extension objects (e.g. structs) with their own data members and destroys them using the xDestroy() callback of each sqlite3_create_XXX() api function. Therefore each sqlite3* database connection gets its own instance of each extension object that uses only its own data members and no global variables to perform calculations.On the other hand, the callback passed to create_XXX() itself is nothing more than a trampoline that calls a method of the user data pointer argument after typecasting it to the appropriate pointer type to the extension object, so it does not access any "common" data. If I understand correctly what you say, each sqlite3* connection instance serializes its calls to its extension callbacks so each instance of the extension objects does not need to perform any additional serialization because it is "guarded" by the serialization of the connection. Is this correct? I hope I was more clear this time, please bare with me because English is not my native language. _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

