diff options
author | drh <drh@noemail.net> | 2007-08-30 20:09:48 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2007-08-30 20:09:48 +0000 |
commit | b67e8bf071b17c68fa27bec65af6d7a0b2f4cb1f (patch) | |
tree | 7c72df365a6d40f67192a0f6e7cae61da06ea21b /src | |
parent | ad3e78b6718ec841d2082c9dec14359be23389ee (diff) | |
download | sqlite-b67e8bf071b17c68fa27bec65af6d7a0b2f4cb1f.tar.gz sqlite-b67e8bf071b17c68fa27bec65af6d7a0b2f4cb1f.zip |
Add the experimental sqlite3_threadsafe() API. (CVS 4350)
FossilOrigin-Name: 1b39a714efbe1f4ccc8daf68a227a8c9b84a388f
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 3 | ||||
-rw-r--r-- | src/sqlite.h.in | 26 |
2 files changed, 27 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c index dc462aa25..eda460fd8 100644 --- a/src/main.c +++ b/src/main.c @@ -14,7 +14,7 @@ ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** -** $Id: main.c,v 1.399 2007/08/30 16:23:19 drh Exp $ +** $Id: main.c,v 1.400 2007/08/30 20:09:48 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -25,6 +25,7 @@ const char sqlite3_version[] = SQLITE_VERSION; const char *sqlite3_libversion(void){ return sqlite3_version; } int sqlite3_libversion_number(void){ return SQLITE_VERSION_NUMBER; } +int sqlite3_threadsafe(void){ return SQLITE_THREADSAFE; } /* ** If the following function pointer is not NULL and if diff --git a/src/sqlite.h.in b/src/sqlite.h.in index e0b3897ac..780fb87bc 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -30,7 +30,7 @@ ** the version number) and changes its name to "sqlite3.h" as ** part of the build process. ** -** @(#) $Id: sqlite.h.in,v 1.250 2007/08/30 16:23:19 drh Exp $ +** @(#) $Id: sqlite.h.in,v 1.251 2007/08/30 20:09:48 drh Exp $ */ #ifndef _SQLITE3_H_ #define _SQLITE3_H_ @@ -113,6 +113,30 @@ const char *sqlite3_libversion(void); int sqlite3_libversion_number(void); /* +** CAPI3REF: Test To See If The Library Is Threadsafe +** +** This routine returns TRUE (nonzero) if SQLite was compiled with +** all of its mutexes enabled and is thus threadsafe. It returns +** zero if the particular build is for single-threaded operation +** only. +** +** Really all this routine does is return true if SQLite was compiled +** with the -DSQLITE_THREADSAFE=1 option and false if +** compiled with -DSQLITE_THREADSAFE=0. If SQLite uses an +** application-defined mutex subsystem, malloc subsystem, collating +** sequence, VFS, SQL function, progress callback, commit hook, +** extension, or other accessories and these add-ons are not +** threadsafe, then clearly the combination will not be threadsafe +** either. Hence, this routine never reports that the library +** is guaranteed to be threadsafe, only when it is guaranteed not +** to be. +** +** This is an experimental API and may go away or change in future +** releases. +*/ +int sqlite3_threadsafe(void); + +/* ** CAPI3REF: Database Connection Handle ** ** Each open SQLite database is represented by pointer to an instance of the |