Home > other >  How to realize the thread in python3 timeout "suicide"?
How to realize the thread in python3 timeout "suicide"?

Time:11-25

Dear bosses, ask a question: python3 multithreaded development, how to realize the thread the longest running time, when the thread running overtime automatically 'suicide', release resources,

CodePudding user response:

Use the thread pool?
Each thread created, go to somewhere to register,
At the end of the thread, to end of the registration,
Regularly traverse the registration centre, if overtime, exit method of thread of execution

CodePudding user response:

references on 1st floor day I reply:
using a thread pool?
Each thread created, go to somewhere to register,
At the end of the thread, to end of the registration,
Traverse the registration center regularly, if the timeout, executing thread exit method



If timing traversal registration centre, time grew, cannot guarantee the timeliness; Timing is short and frequent traversal occupancy resources,
  • Related