还额外定义了调试专用互斥锁结构体sqlite3_debug_mutex
typedef struct sqlite3_debug_mutex { //调试专用互斥体
int id; /* The mutex type */
int cnt; /* Number of entries without a matching leave */
} sqlite3_debug_mutex;
debug调试函数如下,用于assert一些意外情况
| 编号 | 函数名 | 功能 |
|---|---|---|
| 1 | static int debugMutexHeld(sqlite3_mutex *pX) | debug 下检查是否多个进程处于中间状态 |
| 2 | static int debugMutexNotheld(sqlite3_mutex *pX) | debug 下检查是否多个进程处于中间状态 |
| 3 | static int debugMutexInit(void) | DEBUG时初始和销毁互斥体系统,无意义 |
| 4 | static int debugMutexEnd(void) | |
| 5 | static sqlite3_mutex *debugMutexAlloc(int id) | 分配互斥锁,返回互斥体指针 |
| 6 | static void debugMutexFree(sqlite3_mutex *pX) | 销毁互斥锁,主要用于检测 |
| 7 | static void debugMutexEnter(sqlite3_mutex *pX) | 忙则返回SQLITE_BUSY 否则分配锁 未定义同一进程取得多种类型锁的情况 |
| 8 | static int debugMutexTry(sqlite3_mutex *pX) | |
| 9 | static void debugMutexLeave(sqlite3_mutex *pX) | 检查是锁的状态 |
| 10 | sqlite3_mutex_methods const *sqlite3NoopMutex(void) | 定义了sqlite3NoopMutex包含函数指针的结构体 |
| 11 | sqlite3_mutex_methods const *sqlite3DefaultMutex(void) | 返回sqlite3NoopMutex() |