-C Always\sset\sBtShared.db\swhen\sentering\sthe\sBtShared\smutex.\sTicket\s#3793.\s(CVS\s6480)
-D 2009-04-10T09:47:07
+C Changes\sto\sensure\sthat\swhen\srunning\sin\sshared-cache\smode\swith\sa\snon-threadsafe\sbuild,\sthe\scorrect\sbusy-handler\scallback\sis\salways\sinvoked.\s(CVS\s6481)
+D 2009-04-10T12:55:17
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
F src/backup.c 0082d0e5a63f04e88faee0dff0a7d63d3e92a78d
F src/bitvec.c ef370407e03440b0852d05024fb016b14a471d3d
-F src/btmutex.c 527b63e275d132564710dec47ddab52a0f2d7f4e
+F src/btmutex.c 9b899c0d8df3bd68f527b0afe03088321b696d3c
F src/btree.c 8331febf3769cdac2e0cde463be4ed901406b783
-F src/btree.h 8007018c1753944790c39610280894ab280210b8
+F src/btree.h 99fcc7e8c4a1e35afe271bcb38de1a698dfc904e
F src/btreeInt.h df64030d632f8c8ac217ed52e8b6b3eacacb33a5
F src/build.c 2882f22078db1c3f887b1aca77ff460cf9461c62
F src/callback.c 73016376d6848ba987709e8c9048d4f0e0776036
F src/utf.c 9541d28f40441812c0b40f00334372a0542c00ff
F src/util.c 469d74f5bf09ed6398702c7da2ef8a34e979a1c1
F src/vacuum.c 07121a727beeee88f27d704a00313ad6a7c9bef0
-F src/vdbe.c 146b72ae0783281b39049593c422a9a1527e82d3
+F src/vdbe.c 88bc70921ccdcff8bfdf574f3e2285d17ab97103
F src/vdbe.h 35a648bc3279a120da24f34d9a25213ec15daf8a
-F src/vdbeInt.h 53a2f4696871712646c77351904576cca6ad9752
+F src/vdbeInt.h df5c5a1c739c98af2c83440dde3fc361240f3a25
F src/vdbeapi.c d3c6f28dbf462187f3fd696f2357e0d23940abac
-F src/vdbeaux.c e1aa4cd6f4972f2420e38e195df4297349f109aa
+F src/vdbeaux.c b48b0af5acd527ffe31a6da4f61971f7bd0bec0b
F src/vdbeblob.c e67757450ae8581a8b354d9d7e467e41502dfe38
F src/vdbemem.c 9798905787baae83d0b53b62030e32ecf7a0586f
F src/vtab.c f1aba5a6dc1f83b97a39fbbc58ff8cbc76311347
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 2cc68272b1f70701268075cfa82fa64bb2a8179d
-R 0f5ed1cbc4ec520cfd83afb78d3917f3
+P ed6620ba589ddbb6ca86f42a7652e3b019195647
+R 59f76bf89532711f903241145d0b77ea
U danielk1977
-Z 46ae6a8835e1cba4786ac026de3d9fbb
+Z ac75d7099ed4abde9c5f40681fcfbea3
-ed6620ba589ddbb6ca86f42a7652e3b019195647
\ No newline at end of file
+683e4bd74783e6e3f6cf75f9582008c7b7e02a01
\ No newline at end of file
**
*************************************************************************
**
-** $Id: btmutex.c,v 1.14 2009/04/10 09:47:07 danielk1977 Exp $
+** $Id: btmutex.c,v 1.15 2009/04/10 12:55:17 danielk1977 Exp $
**
** This file contains code used to implement mutexes on Btree objects.
** This code really belongs in btree.c. But btree.c is getting too
** a good breakout.
*/
#include "btreeInt.h"
-#if SQLITE_THREADSAFE && !defined(SQLITE_OMIT_SHARED_CACHE)
+#ifndef SQLITE_OMIT_SHARED_CACHE
+#if SQLITE_THREADSAFE
/*
** Obtain the BtShared mutex associated with B-Tree handle p. Also,
}
}
-
-#endif /* SQLITE_THREADSAFE && !SQLITE_OMIT_SHARED_CACHE */
+#else
+void sqlite3BtreeEnter(Btree *p){
+ p->pBt->db = p->db;
+}
+void sqlite3BtreeEnterAll(sqlite3 *db){
+ int i;
+ for(i=0; i<db->nDb; i++){
+ Btree *p = db->aDb[i].pBt;
+ if( p ){
+ p->pBt->db = p->db;
+ }
+ }
+}
+#endif /* if SQLITE_THREADSAFE */
+#endif /* ifndef SQLITE_OMIT_SHARED_CACHE */
** subsystem. See comments in the source code for a detailed description
** of what each interface routine does.
**
-** @(#) $Id: btree.h,v 1.112 2009/04/02 20:16:59 drh Exp $
+** @(#) $Id: btree.h,v 1.113 2009/04/10 12:55:17 danielk1977 Exp $
*/
#ifndef _BTREE_H_
#define _BTREE_H_
** use mutexes to access the BtShared structures. So make the
** Enter and Leave procedures no-ops.
*/
-#if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE
+#ifndef SQLITE_OMIT_SHARED_CACHE
void sqlite3BtreeEnter(Btree*);
- void sqlite3BtreeLeave(Btree*);
-#ifndef NDEBUG
- /* This routine is used inside assert() statements only. */
- int sqlite3BtreeHoldsMutex(Btree*);
+ void sqlite3BtreeEnterAll(sqlite3*);
+#else
+# define sqlite3BtreeEnter(X)
+# define sqlite3BtreeEnterAll(X)
#endif
+
+#if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE
+ void sqlite3BtreeLeave(Btree*);
void sqlite3BtreeEnterCursor(BtCursor*);
void sqlite3BtreeLeaveCursor(BtCursor*);
- void sqlite3BtreeEnterAll(sqlite3*);
void sqlite3BtreeLeaveAll(sqlite3*);
-#ifndef NDEBUG
- /* This routine is used inside assert() statements only. */
- int sqlite3BtreeHoldsAllMutexes(sqlite3*);
-#endif
void sqlite3BtreeMutexArrayEnter(BtreeMutexArray*);
void sqlite3BtreeMutexArrayLeave(BtreeMutexArray*);
void sqlite3BtreeMutexArrayInsert(BtreeMutexArray*, Btree*);
-#else
-# define sqlite3BtreeEnter(X)
-# define sqlite3BtreeLeave(X)
#ifndef NDEBUG
- /* This routine is used inside assert() statements only. */
-# define sqlite3BtreeHoldsMutex(X) 1
+ /* These routines are used inside assert() statements only. */
+ int sqlite3BtreeHoldsMutex(Btree*);
+ int sqlite3BtreeHoldsAllMutexes(sqlite3*);
#endif
+#else
+
+# define sqlite3BtreeLeave(X)
# define sqlite3BtreeEnterCursor(X)
# define sqlite3BtreeLeaveCursor(X)
-# define sqlite3BtreeEnterAll(X)
# define sqlite3BtreeLeaveAll(X)
-#ifndef NDEBUG
- /* This routine is used inside assert() statements only. */
-# define sqlite3BtreeHoldsAllMutexes(X) 1
-#endif
# define sqlite3BtreeMutexArrayEnter(X)
# define sqlite3BtreeMutexArrayLeave(X)
# define sqlite3BtreeMutexArrayInsert(X,Y)
+
+# define sqlite3BtreeHoldsMutex(X) 1
+# define sqlite3BtreeHoldsAllMutexes(X) 1
#endif
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
-** $Id: vdbe.c,v 1.831 2009/04/10 00:56:29 drh Exp $
+** $Id: vdbe.c,v 1.832 2009/04/10 12:55:17 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "vdbeInt.h"
assert( p->magic==VDBE_MAGIC_RUN ); /* sqlite3_step() verifies this */
assert( db->magic==SQLITE_MAGIC_BUSY );
- sqlite3BtreeMutexArrayEnter(&p->aMutex);
+ sqlite3VdbeMutexArrayEnter(p);
if( p->rc==SQLITE_NOMEM ){
/* This happens if a malloc() inside a call to sqlite3_column_text() or
** sqlite3_column_text16() failed. */
** 6000 lines long) it was split up into several smaller files and
** this header information was factored out.
**
-** $Id: vdbeInt.h,v 1.166 2009/03/18 10:33:02 danielk1977 Exp $
+** $Id: vdbeInt.h,v 1.167 2009/04/10 12:55:17 danielk1977 Exp $
*/
#ifndef _VDBEINT_H_
#define _VDBEINT_H_
int sqlite3VdbeReleaseBuffers(Vdbe *p);
#endif
+#ifndef SQLITE_OMIT_SHARED_CACHE
+void sqlite3VdbeMutexArrayEnter(Vdbe *p);
+#else
+# define sqlite3VdbeMutexArrayEnter(p)
+#endif
+
int sqlite3VdbeMemTranslate(Mem*, u8);
#ifdef SQLITE_DEBUG
void sqlite3VdbePrintSql(Vdbe*);
** to version 2.8.7, all this code was combined into the vdbe.c source file.
** But that file was getting too big so this subroutines were split out.
**
-** $Id: vdbeaux.c,v 1.449 2009/04/10 00:56:29 drh Exp $
+** $Id: vdbeaux.c,v 1.450 2009/04/10 12:55:17 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "vdbeInt.h"
return rc;
}
+/*
+** If SQLite is compiled to support shared-cache mode and to be threadsafe,
+** this routine obtains the mutex associated with each BtShared structure
+** that may be accessed by the VM passed as an argument. In doing so it
+** sets the BtShared.db member of each of the BtShared structures, ensuring
+** that the correct busy-handler callback is invoked if required.
+**
+** If SQLite is not threadsafe but does support shared-cache mode, then
+** sqlite3BtreeEnterAll() is invoked to set the BtShared.db variables
+** of all of BtShared structures accessible via the database handle
+** associated with the VM. Of course only a subset of these structures
+** will be accessed by the VM, and we could use Vdbe.btreeMask to figure
+** that subset out, but there is no advantage to doing so.
+**
+** If SQLite is not threadsafe and does not support shared-cache mode, this
+** function is a no-op.
+*/
+#ifndef SQLITE_OMIT_SHARED_CACHE
+void sqlite3VdbeMutexArrayEnter(Vdbe *p){
+#if SQLITE_THREADSAFE
+ sqlite3BtreeMutexArrayEnter(&p->aMutex);
+#else
+ sqlite3BtreeEnterAll(p->db);
+#endif
+}
+#endif
+
/*
** This routine is called the when a VDBE tries to halt. If the VDBE
** has made changes and is in autocommit mode, then commit those
int isSpecialError; /* Set to true if a 'special' error */
/* Lock all btrees used by the statement */
- sqlite3BtreeMutexArrayEnter(&p->aMutex);
+ sqlite3VdbeMutexArrayEnter(p);
/* Check for one of the special errors */
mrc = p->rc & 0xff;