-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 07/09/2010 01:52 PM, Eric Smith wrote: > What do you mean, "immediately"? As I said, my child comes to life, > does some work without touching (its copy of) existing SQLite strucures, > and then calls exit(2).
I'll bet you are actually getting exit(3) which means anything registered with atexit will be run. (SQLite does not register with atexit.) In my wrapper I provide functionality that can check SQLite objects are not being used across processes. The way it does this is by providing an alternate mutex implementation (almost every SQLite operation acquires and releases mutexes) and verifies the mutex is used in the same process id it was allocated in. In a benchmark doing only SQLite operations I found a 1% performance hit. A little tricky thing is that you can't change mutex implementations after SQLite has initialised. Consequently the code ensures SQLite is initialised to get the current mutex implementation, then does a shutdown, installs the new implementation and initialises SQLite again. You should not shutdown SQLite unless all items are fully closed and freed. Therefore this code is best run as close to the beginning of main() as possible. I'd recommend doing something like this, even if it is only enabled during testing because other people may write code, or after time has passed you may forget about the whole forking issue. You can see example code at: http://code.google.com/p/apsw/source/browse/src/apsw.c#858 Roger -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkw3kxkACgkQmOOfHg372QTomgCg1g8LUOQnJK7z3B0j2tsax6FN 2OsAn1K6eO1zHZx+eR66PVasjaugm9tp =Hm6K -----END PGP SIGNATURE----- _______________________________________________ sqlite-users mailing list firstname.lastname@example.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users