I want to add a timeout on one function which is getting called inside a child thread.
I can't use a signal, as a signal should be on the main thread.
I can't use thread.join(time_out)
, as that function can sometimes be executed in a few seconds, and in those cases the thread will always wait out the time_out
.
Are there any other approaches?
Sources:
thread.join
: Timeout function using threading in python does not worksignal
: Timeout function if it takes too long to finish