Fix threading issue in ConnectionManager

As reported here: https://github.com/SamSaffron/message_bus/issues/18

Let us (@tskogberg and I) know if you think this is not good enough.
yeah, lets clean this up ... I don't think we even need to inherit off Set,
just wrap a set.

On Fri, Sep 19, 2014 at 7:10 PM, Joakim Kolsjö <notifications@github.com>
wrote:

> In lib/message_bus/connection_manager.rb:
>
> > @@ -2,6 +2,31 @@
> >
> >  class MessageBus::ConnectionManager
> >
> > +  class SynchronizedSet < Set
> > +
> > +    def initialize
> > +      super
> > +      @mutex = Mutex.new
> > +    end
> > +
> > +    alias_method :parent_add, :"<<"
> > +    def <<(element)
> > +      @mutex.synchronize do
> > +        parent_add element
>
> Would it be possible to just do super(element) instead of using
> alias_method? It's not overriding a method in place (e.g. by monkey
> patching) so you ought to be able to use super.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/SamSaffron/message_bus/pull/19/files#r17775551>.
>