From: danielk1977 Date: Fri, 15 Jun 2007 17:50:04 +0000 (+0000) Subject: Fix a race condition in test_server.c/test7.c (test changes only). (CVS 4073) X-Git-Tag: version-3.4.0~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3586110b4a51d7827fae7469af6f08479a7fff75;p=thirdparty%2Fsqlite.git Fix a race condition in test_server.c/test7.c (test changes only). (CVS 4073) FossilOrigin-Name: d0de32e4c630c43ecd9d5e5296ae84aeff80c083 --- diff --git a/manifest b/manifest index 116e5c3e9e..d1f9bccd48 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\stypo\sin\schange\scomments\sfor\s3.4.0.\s\sTicket\s#2416\s(CVS\s4072) -D 2007-06-15T17:04:38 +C Fix\sa\srace\scondition\sin\stest_server.c/test7.c\s(test\schanges\sonly).\s(CVS\s4073) +D 2007-06-15T17:50:04 F Makefile.in b9971ab07868cf2b3209fe3bf8c52e7e25af4193 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -126,7 +126,7 @@ F src/test_hexio.c 14c007252285c6dabcec4a28fcf08e9177e85178 F src/test_loadext.c 22065d601a18878e5542191001f0eaa5d77c0ed8 F src/test_md5.c 6c42bc0a3c0b54be34623ff77a0eec32b2fa96e3 F src/test_schema.c ced72140a3a25c148975428e170ec1850d3c3a7d -F src/test_server.c a6460daed0b92ecbc2531b6dc73717470e7a648c +F src/test_server.c 76c0baf509abe65ca6e5c7974ab0097cfdd8b833 F src/test_tclvar.c 315e77c17f128ff8c06b38c08617fd07c825a95b F src/tokenize.c 6cef9e6fc454d789a32c5b509ccb193a2b01977b F src/trigger.c 420192efe3e6f03addf7897c60c3c8bf913d3493 @@ -505,7 +505,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P d0b6e9a07e99cc1a7d7f61877918c9a247899996 -R 9087f698020fc19e6fdd907a04804533 -U drh -Z 4374a21937759a53303f0172830b42c7 +P 1f6f0330000ca564e75cd930afb9f9ce23551d89 +R a0ee010a5bef0de1c3d00cec7cb6d958 +U danielk1977 +Z 8b3ca4bc021641212b2bd6f7678c807f diff --git a/manifest.uuid b/manifest.uuid index 930a6cb1b4..f9fb3eed57 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1f6f0330000ca564e75cd930afb9f9ce23551d89 \ No newline at end of file +d0de32e4c630c43ecd9d5e5296ae84aeff80c083 \ No newline at end of file diff --git a/src/test_server.c b/src/test_server.c index 5929bd497b..db213cf673 100644 --- a/src/test_server.c +++ b/src/test_server.c @@ -449,8 +449,8 @@ void *sqlite3_server(void *NotUsed){ pthread_mutex_unlock(&pMsg->clientMutex); pthread_cond_signal(&pMsg->clientWakeup); } - pthread_mutex_unlock(&g.serverMutex); sqlite3_thread_cleanup(); + pthread_mutex_unlock(&g.serverMutex); return 0; } @@ -473,12 +473,14 @@ void sqlite3_server_start(void){ ** If a server thread is running, then stop it. If no server is ** running, this routine is effectively a no-op. ** -** This routine returns immediately without waiting for the server -** thread to stop. But be assured that the server will eventually stop. +** This routine waits until the server has actually stopped before +** returning. */ void sqlite3_server_stop(void){ g.serverHalt = 1; pthread_cond_broadcast(&g.serverWakeup); + pthread_mutex_lock(&g.serverMutex); + pthread_mutex_unlock(&g.serverMutex); } #endif /* defined(OS_UNIX) && OS_UNIX && defined(THREADSAFE) && THREADSAFE */