Hi everyone!
I have a program that would create a child process. The run-through of the
part of the program is as follows:
[code]
int main()
{
pid_t pid;
int status = -1;
static sqlite3 *dbPtr;
status = sqlite3_open( "mine.db", dbPtr );
while(1)
{
if((pid = fork()) == 0)
{
printf("before closing parent db copy");
sqlite3_close(dbPtr);
dbPtr = NULL;
printf("after closing parent db copy");
status = sqlite3_open("mine.db", dbPtr);
if(status == SQLITE_OK)
{
// do some db queries here
sqlite3_close(dbPtr);
}
}
sleep(5);
}
return(0);
}
[/code]
Kindly take note of the sqlite3_close between the printings. I put it there
for the reason that when a new process is forked, it creates a new dbPtr as
a copy of the parent's dbPtr. I closed it then and opened so that the child
can have its own session of sqlite transactions.
However when I run the program for several hours, it would just print
"before closing parent db copy". And when i issue a ps command, there are
already 2 instances of the program running (1 parent and 1 child). And the
child is now running for an hour or so.
So if that is the case, maybe there is something in sqlite3_close that lets
the child process to halt. Im not sure though.
Any inputs will be greatly appreciated. Thank you so much!
--
View this message in context:
http://www.nabble.com/process-blocks-on-sqlite3_close--tp20493813p20493813.html
Sent from the SQLite mailing list archive at Nabble.com.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users