0

I want to code decorator which interrupt function after 1 sec, so:

@timer
def func():
    sleep(0.1)

is OK, but

@timer
def func():
    sleep(1.1)

is RunTimeError.

But i dont understand where in decorator i should code signal. maybe there are similar examples?

anon.for
  • 57
  • 5
  • 1
    Please provide enough code so others can better understand or reproduce the problem. – Community Apr 20 '22 at 13:41
  • Does this answer your question? [Timeout function if it takes too long to finish](https://stackoverflow.com/questions/2281850/timeout-function-if-it-takes-too-long-to-finish) – Mark Plotnick Apr 23 '22 at 22:52

0 Answers0