Sha256: 0bd4c7e955dd385f00c955b7bf083d68f5eb36ce983c8deac68d6e77d764d005
Contents?: true
Size: 686 Bytes
Versions: 104
Compression:
Stored size: 686 Bytes
Contents
=begin rdoc Make a command thread-safe =end require "monitor" module PoolParty extend self module ThreadSafeInstance module ClassMethods def make_safe(meth) original_method = "_unsafe_#{meth}_" alias_method original_method, meth define_method(meth) {|*args| self.class.synchronize { self.send(original_method) } } self end end module InstanceMethods def make_safe meth self.class.make_safe meth end end def self.included(receiver) receiver.extend MonitorMixin receiver.extend ClassMethods receiver.send :include, InstanceMethods end end end
Version data entries
104 entries across 104 versions & 5 rubygems