Index: third_party/sqlite/src/src/test_thread.c |
diff --git a/third_party/sqlite/src/src/test_thread.c b/third_party/sqlite/src/src/test_thread.c |
index fc372a2923433815e13fad0ec0835d70c5b48595..ef191bc2d7cd07e06b5adb6235aecdc19947c74e 100644 |
--- a/third_party/sqlite/src/src/test_thread.c |
+++ b/third_party/sqlite/src/src/test_thread.c |
@@ -13,8 +13,6 @@ |
** This file contains the implementation of some Tcl commands used to |
** test that sqlite3 database handles may be concurrently accessed by |
** multiple threads. Right now this only works on unix. |
-** |
-** $Id: test_thread.c,v 1.15 2009/03/27 12:32:56 drh Exp $ |
*/ |
#include "sqliteInt.h" |
@@ -55,11 +53,12 @@ struct EvalEvent { |
static Tcl_ObjCmdProc sqlthread_proc; |
static Tcl_ObjCmdProc clock_seconds_proc; |
-#if defined(SQLITE_OS_UNIX) && defined(SQLITE_ENABLE_UNLOCK_NOTIFY) |
+#if SQLITE_OS_UNIX && defined(SQLITE_ENABLE_UNLOCK_NOTIFY) |
static Tcl_ObjCmdProc blocking_step_proc; |
static Tcl_ObjCmdProc blocking_prepare_v2_proc; |
#endif |
int Sqlitetest1_Init(Tcl_Interp *); |
+int Sqlite3_Init(Tcl_Interp *); |
/* Functions from test1.c */ |
void *sqlite3TestTextToPtr(const char *); |
@@ -117,7 +116,7 @@ static Tcl_ThreadCreateType tclScriptThread(ClientData pSqlThread){ |
interp = Tcl_CreateInterp(); |
Tcl_CreateObjCommand(interp, "clock_seconds", clock_seconds_proc, 0, 0); |
Tcl_CreateObjCommand(interp, "sqlthread", sqlthread_proc, pSqlThread, 0); |
-#if defined(SQLITE_OS_UNIX) && defined(SQLITE_ENABLE_UNLOCK_NOTIFY) |
+#if SQLITE_OS_UNIX && defined(SQLITE_ENABLE_UNLOCK_NOTIFY) |
Tcl_CreateObjCommand(interp, "sqlite3_blocking_step", blocking_step_proc,0,0); |
Tcl_CreateObjCommand(interp, |
"sqlite3_blocking_prepare_v2", blocking_prepare_v2_proc, (void *)1, 0); |
@@ -126,6 +125,7 @@ static Tcl_ThreadCreateType tclScriptThread(ClientData pSqlThread){ |
#endif |
Sqlitetest1_Init(interp); |
Sqlitetest_mutex_Init(interp); |
+ Sqlite3_Init(interp); |
rc = Tcl_Eval(interp, p->zScript); |
pRes = Tcl_GetObjResult(interp); |
@@ -150,6 +150,8 @@ static Tcl_ThreadCreateType tclScriptThread(ClientData pSqlThread){ |
Tcl_DecrRefCount(pList); |
Tcl_DecrRefCount(pRes); |
Tcl_DeleteInterp(interp); |
+ while( Tcl_DoOneEvent(TCL_ALL_EVENTS|TCL_DONT_WAIT) ); |
+ Tcl_ExitThread(0); |
TCL_THREAD_CREATE_RETURN; |
} |
@@ -390,7 +392,7 @@ static int clock_seconds_proc( |
** should be considered if these functions are to be extended (i.e. to |
** support windows) in the future. |
*/ |
-#if defined(SQLITE_OS_UNIX) && defined(SQLITE_ENABLE_UNLOCK_NOTIFY) |
+#if SQLITE_OS_UNIX && defined(SQLITE_ENABLE_UNLOCK_NOTIFY) |
/* BEGIN_SQLITE_BLOCKING_STEP */ |
/* This example uses the pthreads API */ |
@@ -612,7 +614,7 @@ static int blocking_prepare_v2_proc( |
int SqlitetestThread_Init(Tcl_Interp *interp){ |
Tcl_CreateObjCommand(interp, "sqlthread", sqlthread_proc, 0, 0); |
Tcl_CreateObjCommand(interp, "clock_seconds", clock_seconds_proc, 0, 0); |
-#if defined(SQLITE_OS_UNIX) && defined(SQLITE_ENABLE_UNLOCK_NOTIFY) |
+#if SQLITE_OS_UNIX && defined(SQLITE_ENABLE_UNLOCK_NOTIFY) |
Tcl_CreateObjCommand(interp, "sqlite3_blocking_step", blocking_step_proc,0,0); |
Tcl_CreateObjCommand(interp, |
"sqlite3_blocking_prepare_v2", blocking_prepare_v2_proc, (void *)1, 0); |