From 6ad81c62702028559f2ccc2851842c871a2c79c4 Mon Sep 17 00:00:00 2001 From: Tom Gilbert Date: Sat, 27 Aug 2005 14:16:42 +0000 Subject: better setup for ping timeouts. I need to work on the timer code, it's not currently possible to create a timer within a timer event, due to the thread stop/start thing --- lib/rbot/timer.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/rbot/timer.rb') diff --git a/lib/rbot/timer.rb b/lib/rbot/timer.rb index 64324b6a..03a4c91e 100644 --- a/lib/rbot/timer.rb +++ b/lib/rbot/timer.rb @@ -78,6 +78,7 @@ module Timer # # add an action to the timer def add(period, data=nil, &func) + debug "adding timer, period #{period}" @handle += 1 @timers[@handle] = Action.new(period, data, &func) start_on_add @@ -90,6 +91,7 @@ module Timer # # add an action to the timer which will be run just once, after +period+ def add_once(period, data=nil, &func) + debug "adding one-off timer, period #{period}" @handle += 1 @timers[@handle] = Action.new(period, data, true, &func) start_on_add @@ -135,6 +137,8 @@ module Timer @next_action_time = timer.in end } + #debug "ticked. now #{@timers.length} timers remain" + #debug "next timer due at #{@next_action_time}" end # for backwards compat - this is a bit primitive -- cgit v1.2.3