1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Work toward correct btree locking in a multithreaded environment. (CVS 4307)

FossilOrigin-Name: b8cc493b47e618648f645ab73eb0253739e03fcd
This commit is contained in:
drh
2007-08-28 02:27:51 +00:00
parent da57895fec
commit 900b31ef49
13 changed files with 294 additions and 135 deletions

View File

@@ -13,7 +13,7 @@
** subsystem. See comments in the source code for a detailed description
** of what each interface routine does.
**
** @(#) $Id: btree.h,v 1.86 2007/08/22 02:56:43 drh Exp $
** @(#) $Id: btree.h,v 1.87 2007/08/28 02:27:52 drh Exp $
*/
#ifndef _BTREE_H_
#define _BTREE_H_
@@ -41,6 +41,18 @@
typedef struct Btree Btree;
typedef struct BtCursor BtCursor;
typedef struct BtShared BtShared;
typedef struct BtreeMutexSet BtreeMutexSet;
/*
** This structure records all of the Btrees that need to hold
** a mutex before we enter sqlite3VdbeExec(). The Btrees are
** are placed in aBtree[] in order of aBtree[]->pBt. That way,
** we can always lock and unlock them all quickly.
*/
struct BtreeMutexSet {
int nMutex;
Btree *aBtree[SQLITE_MAX_ATTACHED+1];
};
int sqlite3BtreeOpen(
@@ -170,4 +182,16 @@ void sqlite3BtreeCursorList(Btree*);
int sqlite3BtreePageDump(Btree*, int, int recursive);
#endif
#if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE
void sqlite3BtreeMutexSetEnter(BtreeMutexSet*);
void sqlite3BtreeMutexSetLeave(BtreeMutexSet*);
void sqlite3BtreeMutexSetInsert(BtreeMutexSet*, Btree*);
#else
# define sqlite3BtreeMutexSetEnter(X)
# define sqlite3BtreeMutexSetLeave(X)
# define sqlite3BtreeMutexSetInsert(X,Y)
#endif
#endif /* _BTREE_H_ */