-9

Dot net application has 2 functions. Second function will be executed after the completion of 1st function. sometimes 1st Function hangs and takes lot of time for completion. so after 2 mins I want to kill only first function and make to execute second function. How do we achieve this.

Thanks

  • 1
    Your question is unanswerable as asked. You need to be a *lot* more specific. – Sam Axe Feb 04 '16 at 03:49
  • Possible duplicate of [How to set timeout for a line of c# code](http://stackoverflow.com/questions/13513650/how-to-set-timeout-for-a-line-of-c-sharp-code) – Chris Van Opstal Feb 04 '16 at 03:51

1 Answers1

0

Well it really depends on what language you are using, but you could do something like this in c#:

// create a timer
Timer t = new Timer(120000);
t.elapsed += function2;

public void function1()
{
    t.Enabled = true;
    //Do the rest of your logic here
}

public void function2()
{
    t.Enabled = false;
}

This would cause a timer to begin when you enter the first function. After two minutes the timer would fire and call the second function.

ProgrammingDude
  • 597
  • 1
  • 5
  • 25