mirror of
				https://github.com/sqlite/sqlite.git
				synced 2025-11-03 16:53:36 +03:00 
			
		
		
		
	Make extra calls to sqlite3_shutdown() be harmless no-ops. (CVS 6520)
FossilOrigin-Name: d80822953c2d2f2fd7f6acdd3caa403c0decacc4
This commit is contained in:
		
							
								
								
									
										14
									
								
								manifest
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								manifest
									
									
									
									
									
								
							@@ -1,5 +1,5 @@
 | 
			
		||||
C Revise\sthe\simplementation\sof\ssqlite3_initialize()\sslightly\sin\sorder\sto\smake\nit\smore\seasily\stestable.\s\sThe\sfunctionality\sshould\sbe\sunchanged.\s(CVS\s6519)
 | 
			
		||||
D 2009-04-17T16:54:23
 | 
			
		||||
C Make\sextra\scalls\sto\ssqlite3_shutdown()\sbe\sharmless\sno-ops.\s(CVS\s6520)
 | 
			
		||||
D 2009-04-19T12:23:58
 | 
			
		||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 | 
			
		||||
F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
 | 
			
		||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
 | 
			
		||||
@@ -122,7 +122,7 @@ F src/insert.c 71286d081a919a27ef22eaeccbe2718f93dc6aa9
 | 
			
		||||
F src/journal.c e00df0c0da8413ab6e1bb7d7cab5665d4a9000d0
 | 
			
		||||
F src/legacy.c 2ad5b52df322d0f132f66817095e0e79c8942611
 | 
			
		||||
F src/loadext.c 3f96631089fc4f3871a67f02f2e4fc7ea4d51edc
 | 
			
		||||
F src/main.c b1eac85b643cae84217874e78a73d1ccf0718b00
 | 
			
		||||
F src/main.c 1c68b1be781915d713d07262353c074854cd707f
 | 
			
		||||
F src/malloc.c a1f0f8ae110abb8eb546e259ab0eaea7e0f9b588
 | 
			
		||||
F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c
 | 
			
		||||
F src/mem1.c e6d5c23941288df8191b8a98c28e3f57771e2270
 | 
			
		||||
@@ -157,7 +157,7 @@ F src/resolve.c 094e44450371fb27869eb8bf679aacbe51fdc56d
 | 
			
		||||
F src/rowset.c badb9f36b3a2ced9ee9551f4ce730f5fab442791
 | 
			
		||||
F src/select.c 35225756c247484f473678e5bd191d70a6e4dba0
 | 
			
		||||
F src/shell.c 0a11f831603f17fea20ca97133c0f64e716af4a7
 | 
			
		||||
F src/sqlite.h.in 1537d33b86d022f53a97009e2a0e2229badc23cf
 | 
			
		||||
F src/sqlite.h.in 4a12a7193d4dcceef4f2c6a42a4b8c51f6ccd412
 | 
			
		||||
F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
 | 
			
		||||
F src/sqliteInt.h fcdad0896da9c8b6372db974131e33b7a06606ce
 | 
			
		||||
F src/sqliteLimit.h ffe93f5a0c4e7bd13e70cd7bf84cfb5c3465f45d
 | 
			
		||||
@@ -717,7 +717,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 | 
			
		||||
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 | 
			
		||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 | 
			
		||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 | 
			
		||||
P 97c6ea2368556b2a9a914ba2322085e312598b15
 | 
			
		||||
R 41ba3a8408b6d435c1e0e58bca724f55
 | 
			
		||||
P bb1a390a3d2f79b27e3ec2514ae00f5b22dbfb06
 | 
			
		||||
R bfe81c34d0885c2bfee07a323015841e
 | 
			
		||||
U drh
 | 
			
		||||
Z d98b7bef780e2d16aa5f1f8b742918e9
 | 
			
		||||
Z b04415dd5b051642fb17a59a62ddd487
 | 
			
		||||
 
 | 
			
		||||
@@ -1 +1 @@
 | 
			
		||||
bb1a390a3d2f79b27e3ec2514ae00f5b22dbfb06
 | 
			
		||||
d80822953c2d2f2fd7f6acdd3caa403c0decacc4
 | 
			
		||||
							
								
								
									
										22
									
								
								src/main.c
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								src/main.c
									
									
									
									
									
								
							@@ -14,7 +14,7 @@
 | 
			
		||||
** other files are for internal use by SQLite and should not be
 | 
			
		||||
** accessed by users of the library.
 | 
			
		||||
**
 | 
			
		||||
** $Id: main.c,v 1.537 2009/04/17 16:54:23 drh Exp $
 | 
			
		||||
** $Id: main.c,v 1.538 2009/04/19 12:23:58 drh Exp $
 | 
			
		||||
*/
 | 
			
		||||
#include "sqliteInt.h"
 | 
			
		||||
 | 
			
		||||
@@ -213,18 +213,22 @@ int sqlite3_initialize(void){
 | 
			
		||||
** Undo the effects of sqlite3_initialize().  Must not be called while
 | 
			
		||||
** there are outstanding database connections or memory allocations or
 | 
			
		||||
** while any part of SQLite is otherwise in use in any thread.  This
 | 
			
		||||
** routine is not threadsafe.  Not by a long shot.
 | 
			
		||||
** routine is not threadsafe.  But it is safe to invoke this routine
 | 
			
		||||
** on when SQLite is already shut down.  If SQLite is already shut down
 | 
			
		||||
** when this routine is invoked, then this routine is a harmless no-op.
 | 
			
		||||
*/
 | 
			
		||||
int sqlite3_shutdown(void){
 | 
			
		||||
  sqlite3GlobalConfig.isMallocInit = 0;
 | 
			
		||||
  sqlite3PcacheShutdown();
 | 
			
		||||
  if( sqlite3GlobalConfig.isInit ){
 | 
			
		||||
    sqlite3_os_end();
 | 
			
		||||
    sqlite3GlobalConfig.isMallocInit = 0;
 | 
			
		||||
    sqlite3PcacheShutdown();
 | 
			
		||||
    if( sqlite3GlobalConfig.isInit ){
 | 
			
		||||
      sqlite3_os_end();
 | 
			
		||||
    }
 | 
			
		||||
    sqlite3_reset_auto_extension();
 | 
			
		||||
    sqlite3MallocEnd();
 | 
			
		||||
    sqlite3MutexEnd();
 | 
			
		||||
    sqlite3GlobalConfig.isInit = 0;
 | 
			
		||||
  }
 | 
			
		||||
  sqlite3_reset_auto_extension();
 | 
			
		||||
  sqlite3MallocEnd();
 | 
			
		||||
  sqlite3MutexEnd();
 | 
			
		||||
  sqlite3GlobalConfig.isInit = 0;
 | 
			
		||||
  return SQLITE_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -30,7 +30,7 @@
 | 
			
		||||
** the version number) and changes its name to "sqlite3.h" as
 | 
			
		||||
** part of the build process.
 | 
			
		||||
**
 | 
			
		||||
** @(#) $Id: sqlite.h.in,v 1.441 2009/04/13 14:43:41 drh Exp $
 | 
			
		||||
** @(#) $Id: sqlite.h.in,v 1.442 2009/04/19 12:23:58 drh Exp $
 | 
			
		||||
*/
 | 
			
		||||
#ifndef _SQLITE3_H_
 | 
			
		||||
#define _SQLITE3_H_
 | 
			
		||||
@@ -791,6 +791,11 @@ struct sqlite3_vfs {
 | 
			
		||||
** of sqlite3_initialize() does any initialization.  All other calls
 | 
			
		||||
** are harmless no-ops.
 | 
			
		||||
**
 | 
			
		||||
** A call to sqlite3_shutdown() is an "effective" call if it is the first
 | 
			
		||||
** call to sqlite3_shutdown() since the last sqlite3_initialize().  Only
 | 
			
		||||
** an effective call to sqlite3_shutdown() does any deinitialization.
 | 
			
		||||
** All other calls to sqlite3_shutdown() are harmless no-ops.
 | 
			
		||||
**
 | 
			
		||||
** Among other things, sqlite3_initialize() shall invoke
 | 
			
		||||
** sqlite3_os_init().  Similarly, sqlite3_shutdown()
 | 
			
		||||
** shall invoke sqlite3_os_end().
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user