PS: I used the signal to close the connection to database. Just like: int main () { ... signal (SIGUSR2, (void*)sig_handler); .... }
void sys_sig_handler(int sig) { ... switch(sig) { case SIGUSR2: ... sqlite3_close (db); ... } ... } liubin liu wrote: > > I do the job as you say, but the problem is still here. > > There are several processes who write the database. And the place is not > same each time that the problem happens. > > How could I know the reason exactly? > > > > Pavel Ivanov-2 wrote: >> >>> Because there are several process who use the database. I have another >>> question:Could I close the database of other process in main process? >> >> Just use your favorite IPC mechanism and write your application so >> that main process sends message to other process and when other >> process receives it then it closes its database connection... >> >> Pavel >> >> On Sun, Nov 29, 2009 at 7:46 PM, liubin liu <7101...@sina.com> wrote: >>> >>> Thank you! >>> >>> I'm sorry for not showing clearly the environment is embedded linux on >>> arm >>> board. >>> >>> Because there are several process who use the database. I have another >>> question:Could I close the database of other process in main process? >>> >>> >>> Nick Shaw-3 wrote: >>>> >>>> By "other process" do you mean a separate DLL or similar? You can't >>>> free memory allocated in a DLL from an application, even when that >>>> application has the DLL loaded - Windows will complain. This could be >>>> what's happening. >>>> >>>> Could you instead write the database close call within this other >>>> process, and call it from the main process when you shut down? >>>> >>>> Nick. >>>> >>>> -----Original Message----- >>>> From: sqlite-users-boun...@sqlite.org >>>> [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of liubin liu >>>> Sent: 26 November 2009 02:29 >>>> To: sqlite-users@sqlite.org >>>> Subject: [sqlite] sqlite3 is blocked by transaction when wanting to >>>> close the sqlite3 * >>>> >>>> >>>> My application includes a main process and some other processes. I open >>>> the >>>> database in other process, but at end I will close the database in main >>>> process. >>>> >>>> The problem happens while I close the database. The main process is >>>> blocked. >>>> And I could see the journal file is still there, so I guess there are >>>> still >>>> some transactions. >>>> >>>> How resolve the problem? >>>> >>>> Thanks in advance! >>>> -- >>>> View this message in context: >>>> http://old.nabble.com/sqlite3-is-blocked-by-transaction-when-wanting-to- >>>> close-the-sqlite3-*-tp26523551p26523551.html >>>> Sent from the SQLite mailing list archive at Nabble.com. >>>> >>>> _______________________________________________ >>>> sqlite-users mailing list >>>> sqlite-users@sqlite.org >>>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >>>> _______________________________________________ >>>> sqlite-users mailing list >>>> sqlite-users@sqlite.org >>>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >>>> >>>> >>> >>> -- >>> View this message in context: >>> http://old.nabble.com/sqlite3-is-blocked-by-transaction-when-closing-the-sqlite3-*-tp26523551p26568098.html >>> Sent from the SQLite mailing list archive at Nabble.com. >>> >>> _______________________________________________ >>> sqlite-users mailing list >>> sqlite-users@sqlite.org >>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >>> >> _______________________________________________ >> sqlite-users mailing list >> sqlite-users@sqlite.org >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >> >> > > -- View this message in context: http://old.nabble.com/sqlite3-is-blocked-by-transaction-when-closing-the-sqlite3-*-tp26523551p26635743.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users