Class SynchronizedDelegator
In: lib/thread_safe/synchronized_delegator.rb
Parent: SimpleDelegator

This class provides a trivial way to synchronize all calls to a given object by wrapping it with a `Delegator` that performs `Monitor#enter/exit` calls around the delegated `send`. Example:

  array = [] # not thread-safe on many impls
  array = SynchronizedDelegator.new([]) # thread-safe

A simple `Monitor` provides a very coarse-grained way to synchronize a given object, in that it will cause synchronization for methods that have no need for it, but this is a trivial way to get thread-safety where none may exist currently on some implementations.

This class is currently being considered for inclusion into stdlib, via bugs.ruby-lang.org/issues/8556

Methods

method_missing   new   setup   teardown  

Public Class methods

Public Instance methods

[Validate]