0

I have some function to execute which might take longer time.

What i want to do is if the given function is taking more than 5 second then terminate this task and execute some another function.

if (function(a) > 5 seconds)
    function(b)
else
    function(c)
Mahek Shah
  • 485
  • 2
  • 5
  • 17
  • Thanks. Its exactly the same i am looking for. – Mahek Shah May 03 '18 at 18:21
  • I would scroll down to (or Cmd-F for) the `ProcessPoolExecutor` solution. If it does what you want, it's much shorter and simpler than the other answers, including the accepted one (and portable to Windows, too). – abarnert May 03 '18 at 18:23

0 Answers0