On Sat, 14 Jul 2007 08:59:24 +0900, MenTaLguY <mental / rydia.net> wrote:
>  def publish(publisher, message)
>    @lock.synchronize do
>      @subscriptions[publisher]
>    end.each do |subscriber|
>      subscriber.deliver message
>    end
>    self
>  end

Also, note that this allows the delivery of several messages from
the same publisher to be interspersed (as would an R/W lock).  You
may need to think hard about whether that is okay for your purposes.

-mental