0

I have a process that spawns new threads and does work, when the threads are done I start a new batch of threads. I have an issue where a thread may do an RPC call that sometimes never returns. The RPC unfortunately does not support a timeout feature. I know we can use signals to help timeout a function but since this is multi-threaded I can't utilize that. Is there any recommended way to timeout a function that is called in a thread to a set interval?

1 Answers1

0

To know how to stop/kill threads, you should check out the answer here. As for timing out, if your main thread is waiting for the batch of subthreads to finish, then you can use a standard timer time.time() and then after a sufficient amount of time, use the methods shown in the other answer.

Nebbles
  • 113
  • 7