1 Reply Latest reply on May 10, 2010 4:54 PM by Sean_Wilson

    Timeout Question.

    TherionWare

      Supppose I have  two timeouts of the form:

       

       

       

      -- Checks Internal Database

      TimerData.iPrd = 60000

      internalTimer =

      timeout().new("TimerInternal", TimerData.iPrd, #InternalUpdate)

      timeout

       

      ("TimerInternal").persistent = true

       

       

       

       

       

      -- Checks External Database

      TimerData.ePrd =

      90000

      externalTimer =

      timeout().new("TimerExternal", TimerData.ePrd, #ExternalUpdate)

      timeout

       

      ("TimerExternal").persistent = true

       

      Now, periodically the timers will want to be triggered at the same time, i.e. the internal timer goes of every 60 seconds and the external timer goes off every 90 seconds. So at internal timer cycle 3 and external timer cycle 2 both timeouts want to be executed.

       

      Also bear in mind that each timerout process may take more than the cycle period to complete.

       

      So which timer has priority, if any, and can a timer be executed when another timer is running?

       

       

      Your thoughts welcome!

       

      Thanks In Advance.

      TW.

        • 1. Re: Timeout Question.
          Sean_Wilson Adobe Community Professional

          The Lingo execution engine is single threaded, meaning only one piece of code can be run at a time. So only one timeout callback will run at a time. If, by doing so, it monopolises the CPU then so be it - any other timeouts will effectively wait until that process finishes and the normal idle scan picks up that they should have fired and will call their callback handlers. In this sense timeouts are not metronomically precise so shouldn't be treated as such. Which will fire first in the competition scenario you describe is unknown - try it and see. In an ideal world I imagine it would be the first one added to the timeoutList (i.e. the first one created)