-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 26/02/12 12:40, Patrik Nilsson wrote:
> Yes. My program starts two thread, the main one and a worker. There
> are mutexes so only one at a time can the sqlite interface.

In previous postings to the mailing list when people do things like this,
I believe that it turning out to be a threading bug in their program is
100%.  The onus will be on you to prove that you do not have a threading bug.

Some examples.  Unless you call sqlite3_db_mutex you cannot safely get the
error string.  Unless you keep sqlite3_stmt per thread you can have memory
changed underneath you.  Unless you use SQLITE_TRANSIENT, the memory that
gets used may not be what you intended (your symptoms correlate with this
BTW).

Even if you write perfect thread safe and correct code in 999 places in
your code, getting the thousandth one slightly wrong is enough to cause
problems.

By far the safest thing to do is to either only do SQLite activity in one
thread, or to give each thread its own sqlite3 connection.

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk9KtQ0ACgkQmOOfHg372QTkBgCfVM5gyI43xzd8t3XF7P5BZnPh
+Y8An1+h4d2+8S720wmnOCUBdTnEJLfa
=B1Mc
-----END PGP SIGNATURE-----
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to