Simplify os_unix.c by removing support for LinuxThreads. Linux systems must

either use NPTL or else not share database connections across threads.

FossilOrigin-Name: e294b696ba91512b1ca5547774c51ea07b4cb5bc
This commit is contained in:
drh 2010-05-14 12:43:01 +00:00
parent 308c2a5c0f
commit 8af6c228f8
6 changed files with 202 additions and 688 deletions

View File

@ -1,8 +1,8 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
C Change\sthe\sOSTRACEn()\smacro\sto\sOSTRACE(()).\s\sAlso\srename\ssome\sinternal\sfields\nand\svariables\sin\sos_unix.c\sto\sbe\smore\smeaningful\sand\ssearchable.
D 2010-05-14T11:30:18
C Simplify\sos_unix.c\sby\sremoving\ssupport\sfor\sLinuxThreads.\s\sLinux\ssystems\smust\neither\suse\sNPTL\sor\selse\snot\sshare\sdatabase\sconnections\sacross\sthreads.
D 2010-05-14T12:43:02
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -155,7 +155,7 @@ F src/os.c c0a5dfce2a214dacb679425632d04f8a2021f364
F src/os.h 8a7e2456237ecf3a2e55b02f9fe6091f1ad36902
F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
F src/os_os2.c 665876d5eec7585226b0a1cf5e18098de2b2da19
F src/os_unix.c 1a02adfbc4d85256ca29abfd8015ba2d481f44a6
F src/os_unix.c a725e2dc6f3d72b1776a04898fe088e3bb7d3a04
F src/os_win.c 70c4a3327716213b59adf3a8adf2d5318b044a19
F src/pager.c 1e163a82ae8405433dca559831caa06aafbba3b0
F src/pager.h 76466c3a5af56943537f68b1f16567101a0cd1d0
@ -178,7 +178,7 @@ F src/sqliteLimit.h 196e2f83c3b444c4548fc1874f52f84fdbda40f3
F src/status.c 4df6fe7dce2d256130b905847c6c60055882bdbe
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
F src/tclsqlite.c 6bc5fbde634b9cb42b3d29d674fa6cd0c22c0881
F src/test1.c ff95ca772d1df51618f9f1ef7ea432cdf851f97b
F src/test1.c 7e82b944b123360f6637e0c76699713619fb0742
F src/test2.c 31f1b9d076b4774a22d2605d0af1f34e14a9a7bd
F src/test3.c 4c21700c73a890a47fc685c1097bfb661346ac94
F src/test4.c ad03bb987ddedce928f4258c1e7fa4109a73497d
@ -616,7 +616,7 @@ F test/thread003.test b824d4f52b870ae39fc5bae4d8070eca73085dca
F test/thread004.test f51dfc3936184aaf73ee85f315224baad272a87f
F test/thread005.test bf5c374ca65dd89fd56c8fe511ccfb46875bda5e
F test/thread1.test 862dd006d189e8b0946935db17399dcac2f8ef91
F test/thread2.test 6e0997f7beabb6a7e471bd18740ed04805c785f4
F test/thread2.test e08034b83fe9693ade77049732518e5b3d2d700d
F test/thread_common.tcl 0b07423d29ddb73d4bacbac69268c8d37b6cc5d2
F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b
F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9
@ -684,7 +684,6 @@ F test/tkt3424.test 61f831bd2b071bd128fa5d00fbda57e656ca5812
F test/tkt3442.test 89d7b41a4ec4d9d9b40ab8575d648579fb13cb4f
F test/tkt3457.test edbf54b05cbe5165f00192becbd621038f1615e4
F test/tkt3461.test 228ea328a5a21e8663f80ee3d212a6ad92549a19
F test/tkt3472.test 98c7e54b8fef2b1266a552a66c8e5d88a6908d1d
F test/tkt3493.test 1686cbde85f8721fc1bdc0ee72f2ef2f63139218
F test/tkt3508.test d75704db9501625c7f7deec119fcaf1696aefb7d
F test/tkt3522.test 22ce2ebbcb04a6be56c0977d405c207967318fd6
@ -817,14 +816,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P 2a4014b79b852d8b62b4941495b826f154308d86
R 37128756c9dce53457df39613b6f4fe3
P 5fe529f239cddbf4b7ea57abb02d95cc0d94f5f5
R 5512a2ec91f48237ba41c44554f0cdb3
U drh
Z 94b2ef715590f7f65178f2a83c78e9cb
Z 7e4d9cef7a6cf6a0301b86729a795d9b
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFL7TROoxKgR168RlERAjiXAJ9QoT0+dwOK4gOsVkqzwjqmA09v6gCfeR9r
KFFM3J+na6f57UCJeDctbVQ=
=G13l
iD8DBQFL7UVZoxKgR168RlERAg5mAJ4wza7P9iBLqUhXxXQynpkN9aVQ/gCeJx3P
v/M7Sm67jKczR1nujm0jbQs=
=9Mna
-----END PGP SIGNATURE-----

View File

@ -1 +1 @@
5fe529f239cddbf4b7ea57abb02d95cc0d94f5f5
e294b696ba91512b1ca5547774c51ea07b4cb5bc

File diff suppressed because it is too large Load Diff

View File

@ -5129,9 +5129,6 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
extern int sqlite3_pager_readdb_count;
extern int sqlite3_pager_writedb_count;
extern int sqlite3_pager_writej_count;
#if defined(__linux__) && defined(SQLITE_TEST) && SQLITE_THREADSAFE
extern int threadsOverrideEachOthersLocks;
#endif
#if SQLITE_OS_WIN
extern int sqlite3_os_type;
#endif
@ -5187,10 +5184,6 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
Tcl_LinkVar(interp, "unaligned_string_counter",
(char*)&unaligned_string_counter, TCL_LINK_INT);
#endif
#if defined(__linux__) && defined(SQLITE_TEST) && SQLITE_THREADSAFE
Tcl_LinkVar(interp, "threadsOverrideEachOthersLocks",
(char*)&threadsOverrideEachOthersLocks, TCL_LINK_INT);
#endif
#ifndef SQLITE_OMIT_UTF16
Tcl_LinkVar(interp, "sqlite_last_needed_collation",
(char*)&pzNeededCollation, TCL_LINK_STRING|TCL_LINK_READ_ONLY);

View File

@ -29,10 +29,6 @@ if {[llength [info command thread_step]]==0 || [sqlite3 -has-codec]} {
finish_test
return
}
if {![info exists threadsOverrideEachOthersLocks]} {
finish_test
return
}
# Create some data to work with
#
@ -121,118 +117,6 @@ do_test thread2-2.9 {
thread_halt A
thread_halt B
# Save the original (correct) value of threadsOverrideEachOthersLocks
# so that it can be restored. If this value is left set incorrectly, lots
# of things will go wrong in future tests.
#
set orig_threadOverride $threadsOverrideEachOthersLocks
# Pretend we are on a system (like RedHat9) were threads do not
# override each others locks.
#
set threadsOverrideEachOthersLocks 0
# Verify that we can move database connections between threads as
# long as no locks are held.
#
do_test thread2-3.1 {
thread_create A test.db
set DB [thread_db_get A]
thread_halt A
} {}
do_test thread2-3.2 {
set STMT [sqlite3_prepare $DB {SELECT a FROM t1 LIMIT 1} -1 TAIL]
sqlite3_step $STMT
} SQLITE_ROW
do_test thread2-3.3 {
sqlite3_column_int $STMT 0
} 1
do_test thread2-3.4 {
sqlite3_finalize $STMT
} SQLITE_OK
do_test thread2-3.5 {
set STMT [sqlite3_prepare $DB {SELECT max(a) FROM t1} -1 TAIL]
sqlite3_step $STMT
} SQLITE_ROW
do_test thread2-3.6 {
sqlite3_column_int $STMT 0
} 8
do_test thread2-3.7 {
sqlite3_finalize $STMT
} SQLITE_OK
do_test thread2-3.8 {
sqlite3_close $DB
} {SQLITE_OK}
do_test thread2-3.10 {
thread_create A test.db
thread_compile A {SELECT a FROM t1 LIMIT 1}
thread_step A
thread_finalize A
set DB [thread_db_get A]
thread_halt A
} {}
do_test thread2-3.11 {
set STMT [sqlite3_prepare $DB {SELECT a FROM t1 LIMIT 1} -1 TAIL]
sqlite3_step $STMT
} SQLITE_ROW
do_test thread2-3.12 {
sqlite3_column_int $STMT 0
} 1
do_test thread2-3.13 {
sqlite3_finalize $STMT
} SQLITE_OK
do_test thread2-3.14 {
sqlite3_close $DB
} SQLITE_OK
do_test thread2-3.20 {
thread_create A test.db
thread_compile A {SELECT a FROM t1 LIMIT 3}
thread_step A
set STMT [thread_stmt_get A]
set DB [thread_db_get A]
sqlite3_step $STMT
} SQLITE_ROW
do_test thread2-3.22 {
sqlite3_column_int $STMT 0
} 2
do_test thread2-3.23 {
# The unlock fails here. But because we never check the return
# code from sqlite3OsUnlock (because we cannot do anything about it
# if it fails) we do not realize that an error has occurred.
breakpoint
sqlite3_finalize $STMT
} SQLITE_OK
do_test thread2-3.25 {
thread_db_put A $DB
thread_halt A
} {}
do_test thread2-3.30 {
thread_create A test.db
thread_compile A {BEGIN}
thread_step A
thread_finalize A
thread_compile A {SELECT a FROM t1 LIMIT 1}
thread_step A
thread_finalize A
set DB [thread_db_get A]
set STMT [sqlite3_prepare $DB {INSERT INTO t1 VALUES(99,'error')} -1 TAIL]
sqlite3_step $STMT
} SQLITE_ERROR
do_test thread2-3.32 {
sqlite3_finalize $STMT
} SQLITE_MISUSE
do_test thread2-3.33 {
thread_db_put A $DB
thread_halt A
} {}
# VERY important to set the override flag back to its true value.
#
set threadsOverrideEachOthersLocks $orig_threadOverride
# Also important to halt the worker threads, which are using spin
# locks and eating away CPU cycles.
#

View File

@ -1,39 +0,0 @@
# 2008 November 11
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
# $Id: tkt3472.test,v 1.4 2008/12/03 22:32:45 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
if {![info exists threadsOverrideEachOthersLocks]} {
finish_test
return
}
set ::correctvalue $threadsOverrideEachOthersLocks
puts "threadsOverrideEachOthersLocks = $::correctvalue"
do_test tkt3472-1.1 {
db close
set threadsOverrideEachOthersLocks -1
sqlite3 db test.db
set threadsOverrideEachOthersLocks
} $::correctvalue
do_test tkt3472-1.2 {
db close
set threadsOverrideEachOthersLocks -1
sqlite3 db test.db -readonly 1
set threadsOverrideEachOthersLocks
} $::correctvalue
finish_test