Announcement

Collapse
No announcement yet.

Delay Loop Crashes Esignal

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

  • Delay Loop Crashes Esignal

    Hi All,

    I am confused. I am trying to create a few seconds delay between process, in my efs, inorder to allow an external program to complete some work that I had eSignal initate. I created the following function. This function never exits and the only way out is to crash out.

    What might I have done wrong?
    PHP Code:
    main(){

    Alert.email ("external program do something");

    delay(5);

    ....
    efs  continue processing....


    function 
    delay(pDylAmt){
        var 
    rtnTime getValue("rawtime")+pDylAmt;
        var 
    crtTime getValue("rawtime");
         
        var 
    cnt 0;
        var 
    0;

        while (
    crtTime rtnTime){
            
    crtTime =getValue("rawtime") ;
        } 
    return;

    any suggestion to fix this or a way to create a time delay would be appreciated.
    Last edited by perfectinglife; 07-26-2005, 11:17 AM.
    "Make it a great day"
    [email protected]

  • #2
    In your delay loop you are checking the bar time, which will not be updated until the next bar comes in. You would need to use the system time to create a delay function, something like:

    PHP Code:
    //== delay function, pass delay in milliseconds
    function DelaynMSecs ) {
    var 
    Now = new Date();
    var 
    nTarg Now.getTime() + nMSecs;

        while ( 
    true ) {
            
    Now = new Date();
            if ( 
    Now.getTime() >= nTarg ) break;
        }

        

    Chris

    Comment


    • #3
      Next improvement question

      Hi guys,


      Thanks for the code. It worked pretty well. The only issue I have now is that when the delay loop hits the proessor is spiked to 98% and everything stops updating until the delay loop is completed. Then compounds the problem because the processor is so busy looping that it takes extra time for the external program to complete its work.

      Any idea how I might create a delay with out stopping everything.
      "Make it a great day"
      [email protected]

      Comment


      • #4
        Hello perfectinglife,

        Other than a delay loop, there isn't any other options available to delay the processing of EFS code. Feel free to submit a request for this to [email protected].
        Jason K.
        Project Manager
        eSignal - an Interactive Data company

        EFS KnowledgeBase
        JavaScript for EFS Video Series
        EFS Beginner Tutorial Series
        EFS Glossary
        Custom EFS Development Policy

        New User Orientation

        Comment

        Working...
        X