Slave::ThreadSafe (Class)

In: lib/slave.rb
Parent: Object
o Slave TopLevel

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

Methods

class   ex   inspect   method_missing   new   respond_to?  

Public Class methods

[Source]

     # File lib/slave.rb, line 130
130:       def initialize object
131:         @object = object
132:         @sync = Sync.new
133:       end

Public Instance methods

[Source]

     # File lib/slave.rb, line 146
146:       def class
147:         ex{ @object.class }
148:       end

[Source]

     # File lib/slave.rb, line 134
134:       def ex
135:         @sync.synchronize{ yield }
136:       end

[Source]

     # File lib/slave.rb, line 143
143:       def inspect
144:         ex{ @object.inspect }
145:       end

[Source]

     # File lib/slave.rb, line 137
137:       def method_missing m, *a, &b
138:         ex{ @object.send m, *a, &b }
139:       end

[Source]

     # File lib/slave.rb, line 140
140:       def respond_to? m
141:         ex{ @object.respond_to? m }
142:       end

[Validate]