Hi Ralf,
If I remember correctly you cannot use a SQLite database handle
across threads. Each thread will need to open (and close) the
database itself.
Cheers,
Rob
----- Original Message -----
From: "Ralf Junker" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, March 21, 2006 12:02 PM
Subject: [sqlite] SQLITE_ENABLE_MEMORY_MANAGEMENT: AV when Open / Close DB
in different threads
Hello,
I am using SQLite compiled with SQLITE_ENABLE_MEMORY_MANAGEMENT on Win32.
I execute the following psydocode, all with same DB handle:
* In application's main thread: sqlite3_open
* Create a new thread
* In new thread: sqlite3_close
This creates an access violation in pager.c, lines 2065 to 2076:
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
/* Remove the pager from the linked list of pagers starting at
** ThreadData.pPager if memory-management is enabled.
*/
if( pPager==pTsd->pPager ){
pTsd->pPager = pPager->pNext;
}else{
Pager *pTmp;
for(pTmp = pTsd->pPager; pTmp->pNext!=pPager; pTmp=pTmp->pNext);
pTmp->pNext = pPager->pNext;
}
#endif
While I understand from the FAQ that it might be problematic to use more
than one thread with SQLITE_ENABLE_MEMORY_MANAGEMENT, I wonder if SQLite
should cause an AV in this case?
I even found that other SQL instructions, like INSERT, work fine when
called from the 2nd thread.
Could anybody help, please?
Thanks & regards,
Ralf