I would like to use sqlite with "Go" (golang) language.
There are already several drivers available in this language. But before
using them, I would like to ensure it is really safe.

The normal sequence to access a database is:

  sqlite3_prepare()
  loop
     sqlite3_step()
     sqlite3_column()
  sqlite3_finalize()

Normally, all functions in this sequence are called from the same OS thread.

But Go is inherently a multithreaded language, with many threads running
inside.
Even if the user writes a Go program with only one logical thread, he has
no control about which OS thread will process a function call.

     This means that EACH SUCCESSIVE function in the sequence above can be
processed on a DIFFERENT OS THREAD.

It means that to run safely, sqlite source code should not depend in any
way on the identity of the threads, which must be fully interchangeable.
So, the following conditions should be true. Are these sentences correct ?

1) no local-thread-storage is used in sqlite code.
2) thread id (gettid()) are not used.
3) when a function of the API enters a mutex, it leaves it before the
function returns.
   Between two API function calls, no mutex should be locked (else, it
would be impossible to ensure that the mutex is unlocked by the same thread
that locked it).
4) all file locking information is attached to connections, and not to
threads.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to