Announcement

Collapse
No announcement yet.

setTimeout

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • setTimeout

    It seems Javascript (and therefore EFS) doesn't have any sleep() or wait() functions.

    One workaround in JS would be to use setTimeout()...is that function supported in EFS?

    Has anyone found any other way to do something similar to a sleep() or wait() in EFS?

    Thanks!

    Garth
    Garth

  • #2
    I use a staging mechanism based on ticks and RT Time. I record the time in total number of seconds for an event, then set a stagged delay to wait n seconds before checking on the event (normally to brokers or others).

    Is this what you want to try to accomplish or is it something else?
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Thanks Brad.

      I want a very low, to no, CPU intensive method of implementing a sleep() or wait(), or better yet block() function.

      Other processing (other EFS's) will be happening at the same time, so I don't want a tight loop that will soak CPU.

      I'm thinking setTimeout(), if it is supported, is the best option....

      Garth
      Garth

      Comment


      • #4
        Hi Garth,

        The watch method is supported and I've found it to work quite well and it has very little or no overhead It executes the associated handler function immediately when the watched object changes. The problem I ran into was you were still dependant on a tick coming in to change the object you are watching. Because of the dependance on a tick coming in, I found you could accomplish much the same functionality with simpler conditionals.

        I had tried watching a series object that was based on a diferent timeframe, but wasn't able to get it to work. I have some related ideas that may have promise.... Perhaps with your background, you could take what I started and figure out how to morph it into the equivalent of a setTimeout() function. If you want, send me a note and i can fill you in with what I have done so-far.

        Comment


        • #5
          Originally posted by gspiker
          Thanks Brad.

          I want a very low, to no, CPU intensive method of implementing a sleep() or wait(), or better yet block() function.

          Other processing (other EFS's) will be happening at the same time, so I don't want a tight loop that will soak CPU.

          I'm thinking setTimeout(), if it is supported, is the best option....

          Garth
          Block?? You want to block out portions of code from being executed??

          I still suggest you use the time functions I've suggested as they still allow the efs to operate without LOOPING or STALLING the code and then use a simple STRING to control which functions are allowed to operate within the code.

          For example, if you had 5 main functions "ABCDE" and only wanted one of them to run because the other 4 were BLOCKED, you would simply rebuild the string as "B" (or whatever) and then create a function to parse the string and check if that portion of the code can operate.

          I do some similar types of things with OBJECTS. Depending on what is stored in the object tells the code what portions of other code is allowed to operate.

          Let me know if I can help further.
          Brad Matheny
          eSignal Solution Provider since 2000

          Comment

          Working...
          X