Skip to content

Commit

Permalink
use the synchonize method in lock too
Browse files Browse the repository at this point in the history
  • Loading branch information
thejefflarson committed Feb 7, 2013
1 parent 084252f commit fa88f3d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/daybreak/db.rb
Expand Up @@ -20,7 +20,7 @@ class DB
# @yieldparam [String] key the key to be stored.
def initialize(file, options = {}, &block)
@serializer = (options[:serializer] || Serializer::Default).new
@table = Hash.new &method(:hash_default)
@table = Hash.new(&method(:hash_default))
@journal = Journal.new(file, (options[:format] || Format).new, @serializer) do |record|
if !record
@table.clear
Expand Down Expand Up @@ -201,7 +201,7 @@ def load
# @yieldparam [DB] db
# @return result of the block
def lock
@mutex.synchronize { @journal.lock { yield self } }
synchronize { @journal.lock { yield self } }
end

# Synchronize access to the database from multiple threads
Expand Down

0 comments on commit fa88f3d

Please sign in to comment.