lib/finite_machine/threadable.rb in finite_machine-0.9.1 vs lib/finite_machine/threadable.rb in finite_machine-0.9.2
- old
+ new
@@ -2,27 +2,26 @@
module FiniteMachine
# A mixin to allow instance methods to be synchronized
module Threadable
module InstanceMethods
- @@sync = Sync.new
# Exclusive lock
#
# @return [nil]
#
# @api public
def sync_exclusive(&block)
- @@sync.synchronize(:EX, &block)
+ TwoPhaseLock.synchronize(:EX, &block)
end
# Shared lock
#
# @return [nil]
#
# @api public
def sync_shared(&block)
- @@sync.synchronize(:SH, &block)
+ TwoPhaseLock.synchronize(:SH, &block)
end
end
# Module hook
#