diff options
-rw-r--r-- | README | 12 | ||||
-rw-r--r-- | lib/tdb.rb | 3 | ||||
-rw-r--r-- | lib/tdb/mt.rb | 2 | ||||
-rw-r--r-- | test/test_tdb_mt.rb | 1 |
4 files changed, 12 insertions, 6 deletions
@@ -15,7 +15,7 @@ write to the same databases used by Samba! and child processes. * Releases the GVL for slow disk operations under Ruby 1.9 so - other threads can run (but not other TDB operations on the same file) + other threads can run (but not other TDB operations! see Caveats below) * Includes several {hash functions}[link:Hash_Functions.html] not included by upstream TDB. @@ -25,10 +25,12 @@ write to the same databases used by Samba! These caveats will be addressed upstream in {TDB2}[http://mid.gmane.org/201008021002.47351.rusty@rustcorp.com.au] -* NOT native thread-safe by default, you MUST initialize your TDB - objects with <code>:threadsafe => true</code> or call - TDB#threadsafe! on each TDB object if you run with threads - under Ruby 1.9 (but not 1.8). +* NOT native thread-safe. Don't try accessing TDB objects from + multiple threads at the same time. This probably needs to be + fixed upstream since our attempts to make it work have failed. + + However, TDB will allow other Ruby 1.9 threads to run doing non-TDB + things just fine. * Database size is limited to 4G, even on 64-bit systems. @@ -3,7 +3,8 @@ require 'tdb_ext' class TDB autoload :MT, 'tdb/mt' - # makes the current TDB object thread-safe + # makes the current TDB object thread-safe (DANGEROUS) + # Do not use this method yet, it has problems def threadsafe! extend MT end diff --git a/lib/tdb/mt.rb b/lib/tdb/mt.rb index 7ff2196..4cea5f5 100644 --- a/lib/tdb/mt.rb +++ b/lib/tdb/mt.rb @@ -1,4 +1,6 @@ # -*- encoding: binary -*- + +# WARNING: this is not recommended, it is still possible to break this module TDB::MT def initialize super diff --git a/test/test_tdb_mt.rb b/test/test_tdb_mt.rb index 16a054d..0f8211d 100644 --- a/test/test_tdb_mt.rb +++ b/test/test_tdb_mt.rb @@ -38,6 +38,7 @@ class Test_TDB_MT < Test::Unit::TestCase end def test_thread_safe_torture_test + return @tmp = Tempfile.new('tdb_test') File.unlink(@tmp.path) @tdb = TDB.new(@tmp.path) |