lib/knj/threadhandler.rb in knjrbfw-0.0.32 vs lib/knj/threadhandler.rb in knjrbfw-0.0.33
- old
+ new
@@ -1,10 +1,11 @@
class Knj::Threadhandler
attr_reader :inactive_blocks, :args, :activate_blocks, :mutex, :objects
def initialize(args = {})
require "#{$knjpath}errors"
+ require "tsafe"
@args = args
@objects = []
@args[:timeout] = 5 if !@args[:timeout]
@args[:max] = 50 if !@args[:max]
@@ -112,10 +113,10 @@
#The maximum amount of objects has already been spawned... Sleep 0.1 sec and try to lock an object again...
raise Knj::Errors::Retry
else
#No free objects, but we can spawn a new one and use that...
newobj = @spawn_new_block.call
- @objects << Knj::Threadsafe::Synced_hash.new.merge(
+ @objects << Tsafe::MonHash.new.merge(
:free => false,
:object => newobj
)
STDOUT.print "Spawned db and locked new.\n" if @args[:debug]
end
\ No newline at end of file