--- src/test4.c.ORG	2019-03-01 12:40:32.999064701 +0530
+++ src/test4.c	2019-03-01 12:45:36.986991715 +0530
@@ -165,7 +165,7 @@
 /*
 ** Wait for a thread to reach its idle state.
 */
-static void thread_wait(Thread *p){
+static void Thread_Wait(Thread *p){
   while( p->opnum>p->completed ) sched_yield();
 }
 
@@ -193,7 +193,7 @@
     Tcl_AppendResult(interp, "no such thread", 0);
     return TCL_ERROR;
   }
-  thread_wait(&threadset[i]);
+  Thread_Wait(&threadset[i]);
   return TCL_OK;
 }
 
@@ -201,10 +201,10 @@
 ** Stop a thread.
 */
 static void stop_thread(Thread *p){
-  thread_wait(p);
+  Thread_Wait(p);
   p->xOp = 0;
   p->opnum++;
-  thread_wait(p);
+  Thread_Wait(p);
   sqlite3_free(p->zArg);
   p->zArg = 0;
   sqlite3_free(p->zFilename);
@@ -273,7 +273,7 @@
     Tcl_AppendResult(interp, "no such thread", 0);
     return TCL_ERROR;
   }
-  thread_wait(&threadset[i]);
+  Thread_Wait(&threadset[i]);
   sqlite3_snprintf(sizeof(zBuf), zBuf, "%d", threadset[i].argc);
   Tcl_AppendResult(interp, zBuf, 0);
   return TCL_OK;
@@ -306,7 +306,7 @@
     return TCL_ERROR;
   }
   if( Tcl_GetInt(interp, argv[2], &n) ) return TCL_ERROR;
-  thread_wait(&threadset[i]);
+  Thread_Wait(&threadset[i]);
   if( n<0 || n>=threadset[i].argc ){
     Tcl_AppendResult(interp, "column number out of range", 0);
     return TCL_ERROR;
@@ -342,7 +342,7 @@
     return TCL_ERROR;
   }
   if( Tcl_GetInt(interp, argv[2], &n) ) return TCL_ERROR;
-  thread_wait(&threadset[i]);
+  Thread_Wait(&threadset[i]);
   if( n<0 || n>=threadset[i].argc ){
     Tcl_AppendResult(interp, "column number out of range", 0);
     return TCL_ERROR;
@@ -377,7 +377,7 @@
     Tcl_AppendResult(interp, "no such thread", 0);
     return TCL_ERROR;
   }
-  thread_wait(&threadset[i]);
+  Thread_Wait(&threadset[i]);
   zName = sqlite3ErrName(threadset[i].rc);
   Tcl_AppendResult(interp, zName, 0);
   return TCL_OK;
@@ -408,7 +408,7 @@
     Tcl_AppendResult(interp, "no such thread", 0);
     return TCL_ERROR;
   }
-  thread_wait(&threadset[i]);
+  Thread_Wait(&threadset[i]);
   Tcl_AppendResult(interp, threadset[i].zErr, 0);
   return TCL_OK;
 }
@@ -452,7 +452,7 @@
     Tcl_AppendResult(interp, "no such thread", 0);
     return TCL_ERROR;
   }
-  thread_wait(&threadset[i]);
+  Thread_Wait(&threadset[i]);
   threadset[i].xOp = do_compile;
   sqlite3_free(threadset[i].zArg);
   threadset[i].zArg = sqlite3_mprintf("%s", argv[2]);
@@ -505,7 +505,7 @@
     Tcl_AppendResult(interp, "no such thread", 0);
     return TCL_ERROR;
   }
-  thread_wait(&threadset[i]);
+  Thread_Wait(&threadset[i]);
   threadset[i].xOp = do_step;
   threadset[i].opnum++;
   return TCL_OK;
@@ -547,7 +547,7 @@
     Tcl_AppendResult(interp, "no such thread", 0);
     return TCL_ERROR;
   }
-  thread_wait(&threadset[i]);
+  Thread_Wait(&threadset[i]);
   threadset[i].xOp = do_finalize;
   sqlite3_free(threadset[i].zArg);
   threadset[i].zArg = 0;
@@ -579,14 +579,14 @@
     Tcl_AppendResult(interp, "no such thread", 0);
     return TCL_ERROR;
   }
-  thread_wait(&threadset[i]);
+  Thread_Wait(&threadset[i]);
   j = parse_thread_id(interp, argv[2]);
   if( j<0 ) return TCL_ERROR;
   if( !threadset[j].busy ){
     Tcl_AppendResult(interp, "no such thread", 0);
     return TCL_ERROR;
   }
-  thread_wait(&threadset[j]);
+  Thread_Wait(&threadset[j]);
   temp = threadset[i].db;
   threadset[i].db = threadset[j].db;
   threadset[j].db = temp;
@@ -620,7 +620,7 @@
     Tcl_AppendResult(interp, "no such thread", 0);
     return TCL_ERROR;
   }
-  thread_wait(&threadset[i]);
+  Thread_Wait(&threadset[i]);
   sqlite3TestMakePointerStr(interp, zBuf, threadset[i].db);
   threadset[i].db = 0;
   Tcl_AppendResult(interp, zBuf, (char*)0);
@@ -651,7 +651,7 @@
     Tcl_AppendResult(interp, "no such thread", 0);
     return TCL_ERROR;
   }
-  thread_wait(&threadset[i]);
+  Thread_Wait(&threadset[i]);
   assert( !threadset[i].db );
   threadset[i].db = (sqlite3*)sqlite3TestTextToPtr(argv[2]);
   return TCL_OK;
@@ -683,7 +683,7 @@
     Tcl_AppendResult(interp, "no such thread", 0);
     return TCL_ERROR;
   }
-  thread_wait(&threadset[i]);
+  Thread_Wait(&threadset[i]);
   sqlite3TestMakePointerStr(interp, zBuf, threadset[i].pStmt);
   threadset[i].pStmt = 0;
   Tcl_AppendResult(interp, zBuf, (char*)0);
