Method: MessageBus::TimerThread#stop

Defined in:
lib/message_bus/timer_thread.rb

#stopObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/message_bus/timer_thread.rb', line 42

def stop
  @stopped = true
  running = true
  while running
    @mutex.synchronize do
      running = @thread && @thread.alive?

      if running
        begin
          @thread.wakeup
        rescue ThreadError
          raise if @thread.alive?
        end
      end
    end
    sleep 0
  end
end