Skip to content
Browse files

that's actually what i want

  • Loading branch information...
1 parent fd7b9e4 commit 545ef50e2a581f405908982e750be592c92773d0 Nick Kallen committed
Showing with 3 additions and 4 deletions.
  1. +3 −4 util/synchronizable.rb
View
7 util/synchronizable.rb
@@ -1,12 +1,11 @@
module Synchronizable
@@mutex = Mutex.new
- @@mutexes = Hash.new do |h,k|
- h[k] = Mutex.new
- end
def mutex(mutex)
@@mutex.synchronize do
- @@mutexes[mutex]
+ (@mutexes ||= Hash.new do |h,k|
+ h[k] = Mutex.new
+ end)[mutex]
end
end

0 comments on commit 545ef50

Please sign in to comment.
Something went wrong with that request. Please try again.