4 ** The author disclaims copyright to this source code. In place of
5 ** a legal notice, here is a blessing:
7 ** May you do good and not evil.
8 ** May you find forgiveness for yourself and forgive others.
9 ** May you share freely, never taking more than you give.
11 *************************************************************************
19 static char *shared_thread1(int iTid
, void *pArg
){
20 Error err
= {0}; /* Error code and message */
22 while( !timetostop(&err
) ){
23 Sqlite db
= {0}; /* SQLite database connection */
24 opendb(&err
, &db
, "test.db", 0);
25 sql_script(&err
, &db
, "SELECT * FROM t1");
28 print_and_free_err(&err
);
29 return sqlite3_mprintf("done!");
33 static void shared1(int nMs
){
35 Sqlite db
= {0}; /* SQLite database connection */
36 Threadset threads
= {0};
39 opendb(&err
, &db
, "test.db", 1);
40 sql_script(&err
, &db
, "CREATE TABLE t1(x)");
43 setstoptime(&err
, nMs
);
44 sqlite3_enable_shared_cache(1);
46 for(ii
=0; ii
<5; ii
++){
47 launch_thread(&err
, &threads
, shared_thread1
, 0);
50 join_all_threads(&err
, &threads
);
51 sqlite3_enable_shared_cache(0);
53 print_and_free_err(&err
);