Home > Community > Forums > Custom IC SKILL > timer event / procedure // multitasking

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 timer event / procedure // multitasking 

Last post Wed, Nov 4 2009 2:25 AM by mkzz. 3 replies.
Started by mkzz 03 Nov 2009 08:05 AM. Topic has 3 replies and 1578 views
Page 1 of 1 (4 items)
Sort Posts:
  • Tue, Nov 3 2009 8:05 AM

    • mkzz
    • Not Ranked
    • Joined on Tue, Nov 3 2009
    • Posts 2
    • Points 40
    timer event / procedure // multitasking Reply

    Hello all!

    I have two questions - any help would be appreciated :)

     1) how do I write a skill-procedure, which is executed every 10 seconds? (without blocking other processes)

     2) how do I "wait" in an active skill (procedure/code) and execute all other procedures (started before)
         e.g.: The user pushed a button on my skill-app and some code is executed (e.g. running 1h).
                 BUT the "mother" icfb must not be blocked permanently. (background process)

    background: I use multible small apps/guis (hiCreateAppForm) in parallel. One of them is intended to monitor sim-progress.
    all is running fine. but i want to "automize" the "scan"-button to be executed periodically without blocking other apps permanently.

    solution for 1) in windows/delphi would be the "ontimer"-event of an timer-object
    solution for 2) in windows/delphi would be to call "Application.ProcessMessages" regularly.

     thanx in advance,

    mrkzz

    ps virtuoso env. 5.10.41.500.6.133

    • Post Points: 35
  • Tue, Nov 3 2009 8:34 AM

    Re: timer event / procedure // multitasking Reply

    mrkzz,

    One thing to bear in mind is that SKILL is not multi-threaded. So there are some limits as to what  you can do in this regard.

    There is the ability to take advantage of the top level event loop to schedule things which are "sort of" in the background. See this Cadence Online Support Solution 11381132. This encapsulates the hiRegTimer() function in a package which makes it easy to schedule small background tasks. Please take note of the comments in the code about ensuring that jobs are kept short.

    For bigger tasks which are likely to block (such as your 1 hour long job), the best solution is usually to use ipcBeginProcess to launch a background process (maybe an "icfb -nograph -restore script.il" session) - that way it is being executed in an entirely different process.

    Regards,

    Andrew.

    • Post Points: 5
  • Tue, Nov 3 2009 8:40 AM

    • skillUser
    • Top 10 Contributor
    • Joined on Fri, Sep 19 2008
    • Austin, TX
    • Posts 2,567
    • Points 15,575
    Re: timer event / procedure // multitasking Reply

     Hi,

    The "timer" function is hiRegTimer() and it accepts two arguments, the first is a string of the SKILL command that you wish to execute, and the second is the timer delay in tenths of seconds.


    hiRegTimer( t_callbackString x_tenthsofSeconds )=> t | nil

     

    You could use a semaphore or global flag to indicate the status, and use a repeating timer function to check the status and reschedule the next timer event, or not if everything is done.  Make sure that there is a way to override or kill such a repeating timer event too, and make sure that it is not possible to run two or more at the same time.

    Hope this is what you were looking for?

    Regards,

    Lawrence.

    • Post Points: 20
  • Wed, Nov 4 2009 2:25 AM

    • mkzz
    • Not Ranked
    • Joined on Tue, Nov 3 2009
    • Posts 2
    • Points 40
    Re: timer event / procedure // multitasking Reply

    Thanks Lawrence & Andrew!

    My scripts are running now smoothly "as intended" :)

    Using a separate icfb via ipcBeginProcess would cause too much overhead for my approach, I guess. (massive delay, data transfer betw. apps/scripts).
    hiRegTimer is perfect/easy in my case.

    Thanks again,

    mrkzz

    • Post Points: 5
Page 1 of 1 (4 items)
Sort Posts:
Started by mkzz at 03 Nov 2009 08:05 AM. Topic has 3 replies.