Re: [sqlite] sqlite3_create_function and threads
> > Yes. What's wrong with that? > > Nothing at all - I just needed to know whether that was the case so I > could design certain sections of my code accordingly. Three question marks of yours suggested me that you think it's awfully wrong. Note that although your function and application pointer will be shared by all threads SQLite (or in some cases you) will guarantee that this function won't be called simultaneously from different threads for this connection. So you need to introduce some additional thread-safety only if you use the same function and same application pointer for different simultaneous connections. Pavel On Fri, Jul 1, 2011 at 11:11 AM, Technology Lighthouse wrote: > > Yes. What's wrong with that? > > Nothing at all - I just needed to know whether that was the case so I > could design certain sections of my code accordingly. > > Thanks for the help! > -- > Paul Roberts > ___ > 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
Re: [sqlite] sqlite3_create_function and threads
On Fri, Jul 1, 2011 at 11:02 AM, Pavel Ivanov wrote: > > To put it another way, if I call sqlite3_create_function to install a > > custom function, is that function now available to all threads using > > SQLite or is it available only to the thread that made the > > sqlite3_create_function call? > > Yes, it's available to all threads using the same connection. > Pavel is exactly right. But it is important to read and understand the qualifier that Pavel attaches to his answer. One suspects that the OP is working under the assumption that thread==connection, in which case the answer would be "No". Only if all threads share the same database connection is the answer "Yes". > > > And does the same rule apply to the application-defined pointer that can > > optionally be supplied in the sqlite3_create_function call via parameter > > 5??? > > Yes. What's wrong with that? > > > Pavel > > > On Fri, Jul 1, 2011 at 10:53 AM, Technology Lighthouse > wrote: > > From the docs it's unclear to me whether the use of > > sqlite3_create_function is thread-specific or not. > > > > To put it another way, if I call sqlite3_create_function to install a > > custom function, is that function now available to all threads using > > SQLite or is it available only to the thread that made the > > sqlite3_create_function call? > > > > And does the same rule apply to the application-defined pointer that can > > optionally be supplied in the sqlite3_create_function call via parameter > > 5??? > > > > -- > > Paul Roberts > > ___ > > 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 > -- 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] sqlite3_create_function and threads
> Yes. What's wrong with that? Nothing at all - I just needed to know whether that was the case so I could design certain sections of my code accordingly. Thanks for the help! -- Paul Roberts ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] sqlite3_create_function and threads
> To put it another way, if I call sqlite3_create_function to install a > custom function, is that function now available to all threads using > SQLite or is it available only to the thread that made the > sqlite3_create_function call? Yes, it's available to all threads using the same connection. > And does the same rule apply to the application-defined pointer that can > optionally be supplied in the sqlite3_create_function call via parameter > 5??? Yes. What's wrong with that? Pavel On Fri, Jul 1, 2011 at 10:53 AM, Technology Lighthouse wrote: > From the docs it's unclear to me whether the use of > sqlite3_create_function is thread-specific or not. > > To put it another way, if I call sqlite3_create_function to install a > custom function, is that function now available to all threads using > SQLite or is it available only to the thread that made the > sqlite3_create_function call? > > And does the same rule apply to the application-defined pointer that can > optionally be supplied in the sqlite3_create_function call via parameter > 5??? > > -- > Paul Roberts > ___ > 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
[sqlite] sqlite3_create_function and threads
From the docs it's unclear to me whether the use of sqlite3_create_function is thread-specific or not. To put it another way, if I call sqlite3_create_function to install a custom function, is that function now available to all threads using SQLite or is it available only to the thread that made the sqlite3_create_function call? And does the same rule apply to the application-defined pointer that can optionally be supplied in the sqlite3_create_function call via parameter 5??? -- Paul Roberts ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users