From 569c6676a6ddb0ff73821d7693b5e18ddef809b9 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 16 Oct 2014 22:51:35 -0400 Subject: Imported Upstream version 3.2.0 --- src/test7.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/test7.c') diff --git a/src/test7.c b/src/test7.c index 3cd4a22..93bf1e4 100644 --- a/src/test7.c +++ b/src/test7.c @@ -40,6 +40,7 @@ int sqlite3_client_finalize(sqlite3_stmt*); int sqlite3_client_close(sqlite3*); int sqlite3_server_start(void); int sqlite3_server_stop(void); +void sqlite3_server_start2(int *pnDecr); /* ** Each thread is controlled by an instance of the following @@ -68,6 +69,13 @@ struct Thread { int argc; /* number of columns in result */ const char *argv[100]; /* result columns */ const char *colv[100]; /* result column names */ + + /* Initialized to 1 by the supervisor thread when the client is + ** created, and then deemed read-only to the supervisor thread. + ** Is set to 0 by the server thread belonging to this client + ** just before it exits. + */ + int nServer; /* Number of server threads running */ }; /* @@ -175,7 +183,10 @@ static int tcl_client_create( return TCL_ERROR; } pthread_detach(x); - sqlite3_server_start(); + if( threadset[i].nServer==0 ){ + threadset[i].nServer = 1; + sqlite3_server_start2(&threadset[i].nServer); + } return TCL_OK; } @@ -268,6 +279,11 @@ static int tcl_client_halt( for(i=0; i=N_THREAD ){ sqlite3_server_stop(); + while( 1 ){ + for(i=0; i