Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
27 lines (20 loc) · 525 Bytes

File metadata and controls

27 lines (20 loc) · 525 Bytes
Copy raw file
Download raw file
Outline
Edit and raw actions

Thread

构造器

我们以喜闻乐见的为例:

public Thread(Runnable target) {
    init(null, target, "Thread-" + nextThreadNum(), 0);
}

第一个参数为线程组,最后一个为栈大小。init方法就是一些内部属性的赋值操作。

启动

public synchronized void start() {
    if (threadStatus != 0)
        throw new IllegalThreadStateException();
    boolean started = false;
    start0();
    started = true;
}

核心 便在于native方法start0.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.