相关疑难解决方法(0)

Java多线程概念和join()方法

我对join()Java中的Threads中使用的方法感到困惑.在以下代码中:

// Using join() to wait for threads to finish.
class NewThread implements Runnable {

    String name; // name of thread
    Thread t;

    NewThread(String threadname) {
        name = threadname;
        t = new Thread(this, name);
        System.out.println("New thread: " + t);
        t.start(); // Start the thread
    }
// This is the entry point for thread.

    public void run() {
        try {
            for (int i = 5; i > 0; i--) {
                System.out.println(name + ": " + i);
                Thread.sleep(1000);
            }
        } …
Run Code Online (Sandbox Code Playgroud)

java multithreading synchronized pthread-join

57
推荐指数
2
解决办法
11万
查看次数

标签 统计

java ×1

multithreading ×1

pthread-join ×1

synchronized ×1