@repeat = opts[:repeat] if opts.include? :repeat
if block_given?
- @block = block
+ @block = block
elsif opts[:code]
@block = opts[:code]
end
end
def stop
- raise 'already stopped' unless @thread
+ unless @thread
+ warning 'trying to stop already stopped timer'
+ return
+ end
debug "stopping timer #{self}..."
@stopping = true
self.synchronize { @tick.signal }
@actions.delete k unless a.next
end
- nxt = @actions.values.map { |v| v.next }.min
+ nxt = @actions.values.find_all { |v| !v.blocked? }.map{ |v| v.next }.min
if nxt
delta = nxt - now