// Create and start a thread
Thread thread = new MyThread();
thread.start();
// Check if the thread has finished in a non-blocking way
if (thread.isAlive()) {
// Thread has not finished
} else {
// Finished
}
// Wait for the thread to finish but don't wait longer than a
// specified time
long delayMillis = 5000; // 5 seconds
try {
thread.join(delayMillis);
if (thread.isAlive()) {
// Timeout occurred; thread has not finished
} else {
// Finished
}
} catch (InterruptedException e) {
// Thread was interrupted
}
// Wait indefinitely for the thread to finish
try {
thread.join();
// Finished
} catch (InterruptedException e) {
// Thread was interrupted
}
分享到:
相关推荐
In an RTOS, each thread has a separate memory region for its stack. During function execution, data may be added on top of the stack; when the function exits, it removes that data from the stack.
a method to recognize specificity determining.pdf
Modular Incubator Chamber (MIC-...Reliable and simple to use the flow meter provides an inexpensive method of determining when a 100% exchange of gases has been obtained in the Modular Incubator Chamber.
Wikipedia tables represent an important resource, where informationisorganizedw.r.ttableschemasconsistingofcolumns.In turneachcolumn,maycontaininstance values thatpointtoother ...
Watershed planners need a tool for determining width of filter strips that is accurate enough for developing cost-effective site designs and easy enough to use for making quick determinations on a ...
lyapunov exponents (wolf1985年)
简述:Optical flow cannot be computed locally, since only one independent measurement is available from the image sequence at a point, while the flow velocity has two components. A second constraint ...
CHANDY - LAMPORT : Distributed-Snapshots-Determining-Global-States-of-Distributed-Systems
Distributed Snapshots Determining Global States of Distributed Systems
MBA投资课程的经典课本 外文版的,直接购买要好几百RMB
Cellular automata Model: an Adaptive Approach to Determining the Flow of Tollbooths,刘权兴,,Toll plaza is designed for collecting...motorist is hardly happy when has to wait in a long line for paying
解决VMware网卡启动不起来 Determining IP information for failed
分布式快照论文原文,Chandy&Lamport;大作。Lampport个人网站可以免费下载 http://lamport.azurewebsites.net/pubs/pubs.html
For more and more new standards containing patents, the licensing policy of these patents has become the key factor determining whether a standard will be adopted by industry. RAND—the principle of ...
Determining Sample Size.ppt
tautologyhood has the same polynomial degree as the problem of determining whether the first of two given graphs is isomorphic to a subgraph of the second. Other examples are discussed. A method of ...
CPSC-CH-E1002-08.3 Standard Operating Procedure for Determining Total Lead (Pb) in Nonmetal Children’s Products,.zip
a year 0 does not exist in this system. In contrast, astronomical reckoning indeed uses a year 0. For the purpose of distinction, astronomical reckoning drops the symbols AD and BC and uses a plus or...
When a thread is placed at the head of a dispatch queue How the sleep queues are ordered Define a user-level preemption Define a kernel-level preemption Define deterministic dispatch latency Define ...
Normally, only the columns in the WHERE clause are helpful in determining useful indexes, but for a covering index, all columns must be included. If all columns needed for the query are in the index,...