Java线程阻塞计时
PHPz
PHPz 2017-04-18 09:45:07
0
3
398

如何对一个阻塞的线程进行计时?比如阻塞5秒后自动结束线程?

PHPz
PHPz

学习是最好的投资!

reply all(3)
Peter_Zhu

Design a monitor thread to specifically monitor the execution time of other threads. Start timing, then check the thread status every 1 second

刘奇
Thread.sleep(1000L * 5);
return;

I don’t knowsleep whether it can meet the request of the questioner

Ty80

General blocking methods can set a timeout and control it in the thread.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template