lib/zk/threaded_callback.rb in zk-1.5.0 vs lib/zk/threaded_callback.rb in zk-1.5.1

- old
+ new

@@ -122,19 +122,20 @@ @thread = Thread.new(&method(:dispatch_thread_body)) end def dispatch_thread_body Thread.current.abort_on_exception = true + Thread.current[:callback] = @callback while true args = nil @mutex.lock begin @cond.wait(@mutex) while @array.empty? and @state == :running if @state != :running -# logger.warn { "ThreadedCallback, state is #{@state.inspect}, returning" } + logger.warn { "ThreadedCallback, state is #{@state.inspect}, returning" } return end args = @array.shift ensure @@ -145,11 +146,12 @@ callback.call(*args) rescue Exception => e logger.error { e.to_std_format } end end -# ensure -# logger.debug { "#{self.class}##{__method__} returning" } + ensure + Thread.current[:callback] = nil + logger.debug { "##{__method__} returning" } end end end