62.5.10. Thread Safe Array

I wrote this ThreadSafeArray class. Seems to work, but I thought I'd throw
it out here for review. Any holes in this approach?

class ThreadSafeArray
  def initialize
    @mutex = Mutex.new
    @internalArray = []
  end

  def ary
    @internalArray
  end

  def method_missing(method, *args, &block)
    @mutex.lock
    begin
      @internalArray.send(method, *args, &block)
    ensure
      @mutex.unlock
    end
  end
end

Chris Morris
Licence Creative Commons
Tento dokument Ruby, jehož autorem je Radek Hnilica, podléhá licenci Creative Commons Uveďte autora-Nevyužívejte dílo komerčně-Zachovejte licenci 3.0 Česká republika .