Async Timers

Discussion about recent product features & solutions!
2 posts • Page 1 of 1
adambutt
Posts:6
Joined: Wed May 20, 2015 6:05 pm

Async Timers

Post by adambutt »

In Control, is there any way to kick off an asynchronous timer to callback a piece of code after a specified time? I took a look at the TimdeFunc, but it seems cumbersome for what I am looking for. I just want a simple callback to generate a fail to start.

Thanks for your help.

mkoller
Posts:741
Joined: Fri Sep 17, 2010 9:03 am

Re: Async Timers

Post by mkoller »

What about this:

Code: Select all

delay(yourTimeout);
theFunction();
If you have other code in the same script and don't want to block the function including above lines, use it
in a thread explicitely started, e.g.:

Code: Select all

main()
{
  ...
  startThread("delayedFunc");
  ...
}

delayedFunc()
{
  delay(yourTimeout);
  theFunction();
}

2 posts • Page 1 of 1