2N/A#
pragma ident "%Z%%M% %I% %E% SMI" 2N/A** The author disclaims copyright to this source code. In place of 2N/A** a legal notice, here is a blessing: 2N/A** May you do good and not evil. 2N/A** May you find forgiveness for yourself and forgive others. 2N/A** May you share freely, never taking more than you give. 2N/A************************************************************************* 2N/A** Code for testing the the SQLite library in a multithreaded environment. 2N/A** $Id: test4.c,v 1.3 2004/04/23 17:04:45 drh Exp $ 2N/A** Each thread is controlled by an instance of the following 2N/A /* The first group of fields are writable by the master and read-only 2N/A ** to the thread. */ 2N/A char *
zArg;
/* argument usable by xOp */ 2N/A int busy;
/* True if this thread is in use */ 2N/A /* The next group of fields are writable by the thread but read-only to the 2N/A int rc;
/* operation return code */ 2N/A int argc;
/* number of columns in result */ 2N/A const char **
argv;
/* result columns */ 2N/A const char **
colv;
/* result column names */ 2N/A** There can be as many as 26 threads running at once. Each is named 2N/A** by a capital letter: A, B, C, ..., Y, Z. 2N/A** The main loop for a thread. Threads use busy waiting. 2N/A** Get a thread ID which is an upper case letter. Return the index. 2N/A** If the argument is not a valid thread ID put an error message in 2N/A** the interpreter and return -1. 2N/A** Usage: thread_create NAME FILENAME 2N/A** NAME should be an upper case letter. Start the thread running with 2N/A** an open connection to the given database. 2N/A int argc,
/* Number of arguments */ 2N/A const char **
argv /* Text of each argument */ 2N/A** Wait for a thread to reach its idle state. 2N/A** Usage: thread_wait ID 2N/A** Wait on thread ID to reach its idle state. 2N/A int argc,
/* Number of arguments */ 2N/A const char **
argv /* Text of each argument */ 2N/A** Usage: thread_halt ID 2N/A** Cause a thread to shut itself down. Wait for the shutdown to be 2N/A** completed. If ID is "*" then stop all threads. 2N/A int argc,
/* Number of arguments */ 2N/A const char **
argv /* Text of each argument */ 2N/A** Usage: thread_argc ID 2N/A** Wait on the most recent thread_step to complete, then return the 2N/A** number of columns in the result set. 2N/A int argc,
/* Number of arguments */ 2N/A const char **
argv /* Text of each argument */ 2N/A** Usage: thread_argv ID N 2N/A** Wait on the most recent thread_step to complete, then return the 2N/A** value of the N-th columns in the result set. 2N/A int argc,
/* Number of arguments */ 2N/A const char **
argv /* Text of each argument */ 2N/A** Usage: thread_colname ID N 2N/A** Wait on the most recent thread_step to complete, then return the 2N/A** name of the N-th columns in the result set. 2N/A int argc,
/* Number of arguments */ 2N/A const char **
argv /* Text of each argument */ 2N/A** Usage: thread_result ID 2N/A** Wait on the most recent operation to complete, then return the 2N/A** result code from that operation. 2N/A int argc,
/* Number of arguments */ 2N/A const char **
argv /* Text of each argument */ 2N/A default:
zName =
"SQLITE_Unknown";
break;
2N/A** Usage: thread_error ID 2N/A** Wait on the most recent operation to complete, then return the 2N/A int argc,
/* Number of arguments */ 2N/A const char **
argv /* Text of each argument */ 2N/A** This procedure runs in the thread to compile an SQL statement. 2N/A** Usage: thread_compile ID SQL 2N/A** Compile a new virtual machine. 2N/A int argc,
/* Number of arguments */ 2N/A const char **
argv /* Text of each argument */ 2N/A** This procedure runs in the thread to step the virtual machine. 2N/A** Usage: thread_step ID 2N/A** Advance the virtual machine by one step 2N/A int argc,
/* Number of arguments */ 2N/A const char **
argv /* Text of each argument */ 2N/A** This procedure runs in the thread to finalize a virtual machine. 2N/A** Usage: thread_finalize ID 2N/A** Finalize the virtual machine. 2N/A int argc,
/* Number of arguments */ 2N/A const char **
argv /* Text of each argument */ 2N/A** Usage: thread_swap ID ID 2N/A** Interchange the sqlite* pointer between two threads. 2N/A int argc,
/* Number of arguments */ 2N/A const char **
argv /* Text of each argument */ 2N/A** Register commands with the TCL interpreter.