Calling the idle handler?

Excuse me if this has been covered, but I haven’t seen it elsewhere.

Let’s say I have an idle handler that is called every 60 seconds–by virtue of returning a value of 60–but is there a way to deliberately call and re-activate the idle handler before the 60 second loop? Specifically, a condition comes up where I want the idle handler to be called immediately and loop at 1 second intervals, but not wait for it to come around again off the last 60 second loop (under which circumstance it works fine). I have tried just a “idle” statement, “tell me to idle”, “my idle”, “idle of me”, and so on without joy.

A thought I had was to halt the idle, but I think this still requires the last 60 second loop to complete.

TIA.

Well, this simple example of the kludge I came up with seems to work:


property idleInterval : 60
global idle_on

on my_routine()
	-- do some stuff
	set idle_on to false
	set idleInterval to 1
	repeat
		if idle_on is true then exit repeat
		my real_idle_routine()
		delay 1
	end repeat
end my_routine

on idle
	set idle_on to true
	my real_idle_routine()
	return idleInterval
end idle

on real_idle_routine()
	-- do some stuff
end real_idle_routine

The repeat loops, performing the real_idle_routine() handler every second, until the actual idle handler kicks back in to take over, at most repeating 60 times because of my original idle interval.