On 4/15/2016 8:25 PM, Quentin Long wrote:
Have pondered the issue of ensuring that the OS does*not*  label a
seemingly-'frozen' LC app as unresponsive. The following code (which
I haven't actually tried in LC, shame on me) might be helpful. Some
notes after the codeā€¦

========================

local KeepMeAlive = false
local NumSecs = 4

on LifeLine DerStatus

case DerStatus = "on"
put true into KeepMeAlive
TickleMe
break

case DerStatus = "off"
put false into KeepMeAlive
break

default
exit to top
end case

end LifeLine

on TickleMe
if KeepMeAlive = true then send "TickleMe" to me in NumSecs seconds
end TickleMe

========================

How great to see you on the list! Been a while.

I'm afraid the technique won't work though. The first "tickleMe" will trigger when the local is set to "on" but after that a long handler won't return control to the queue until it finishes, so any pending "tickleMe" messages won't execute until the long handler is finished. The fix is to wait 0 with messages inside the long handler, which yields time to the engine and allows LC to do housekeeping. That works best inside a repeat loop, otherwise it gets iffy.

--
Jacqueline Landman Gay         |     jac...@hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to