| In: |
lib/slave.rb
|
| Parent: | Object |
ThreadSafe is a delegate wrapper class used for implementing gross thread safety around existing objects. when an object is wrapped with this class as
ts = ThreadSafe.new{ AnyObject.new }
then ts can be used exactly as the normal object would have been, only all calls are now thread safe. this is the mechanism behind the ‘threadsafe’/:threadsafe keyword to Slave#initialize
# File lib/slave.rb, line 130
130: def initialize object
131: @object = object
132: @sync = Sync.new
133: end
# File lib/slave.rb, line 137
137: def method_missing m, *a, &b
138: ex{ @object.send m, *a, &b }
139: end