确认在 "SQLite3.c" 中,宏 SQLITE_THREADSAFE = 1 或者 2
# define SQLITE_THREADSAFE 1 /* IMP: R-07272-22309 */
#include "Thread.h"
extern "C"
{
#include "SQLite3.h"
};
#include <stdio.h>
#include "Utility.h"
//
int Print(void *pParam, int argc, char ** argv, char ** szColName)
{
for (int i=0; i<argc; ++i) {
printf("%s - %s, ", szColName[i], argv[i]);
}
printf("\n");
return 0;
}
//
class DemoSQLite
{
typedef ThreadT<DemoSQLite> CThread;
public:
DemoSQLite(sqlite3 *pSQLite3)
: m_pSQLite3(pSQLite3)
{
m_lThreadCount = 0;
m_threadRead.owner(this);
m_threadWrite.owner(this);
}
VOID Start()
{
m_threadRead.Start(1);
m_threadWrite.Start(4);
}
VOID Stop()
{
m_threadRead.Stop();
m_threadWrite.Stop();
}
VOID Svc(CThread *pThr