zoukankan      html  css  js  c++  java
  • java里的 thread 源码

    /**
         * Constructs a new {@code Thread} with no {@code Runnable} object and a
         * newly generated name. The new {@code Thread} will belong to the same
         * {@code ThreadGroup} as the {@code Thread} calling this constructor.
         *
         * @see java.lang.ThreadGroup
         * @see java.lang.Runnable
         */
        public Thread() {
            create(null, null, null, 0);
        }

        /**
         * Constructs a new {@code Thread} with a {@code Runnable} object and a
         * newly generated name. The new {@code Thread} will belong to the same
         * {@code ThreadGroup} as the {@code Thread} calling this constructor.
         *
         * @param runnable
         *            a {@code Runnable} whose method <code>run</code> will be
         *            executed by the new {@code Thread}
         *
         * @see java.lang.ThreadGroup
         * @see java.lang.Runnable
         */
        public Thread(Runnable runnable) {
            create(null, runnable, null, 0);
        }

        /**
         * Constructs a new {@code Thread} with a {@code Runnable} object and name
         * provided. The new {@code Thread} will belong to the same {@code
         * ThreadGroup} as the {@code Thread} calling this constructor.
         *
         * @param runnable
         *            a {@code Runnable} whose method <code>run</code> will be
         *            executed by the new {@code Thread}
         * @param threadName
         *            the name for the {@code Thread} being created
         *
         * @see java.lang.ThreadGroup
         * @see java.lang.Runnable
         */
        public Thread(Runnable runnable, String threadName) {
            if (threadName == null) {
                throw new NullPointerException();
            }

            create(null, runnable, threadName, 0);
        }

        /**
         * Constructs a new {@code Thread} with no {@code Runnable} object and the
         * name provided. The new {@code Thread} will belong to the same {@code
         * ThreadGroup} as the {@code Thread} calling this constructor.
         *
         * @param threadName
         *            the name for the {@code Thread} being created
         *
         * @see java.lang.ThreadGroup
         * @see java.lang.Runnable
         *
         */
        public Thread(String threadName) {
            if (threadName == null) {
                throw new NullPointerException();
            }

            create(null, null, threadName, 0);

        }







  • 相关阅读:
    mysql优化---订单查询优化(1):视图优化+索引创建
    docker系列(一):docker基础与安装笔记
    Linux进程管理
    scrapy-redis源码解读之发送POST请求
    anaconda虚拟环境管理,从此Python版本不用愁
    Ubuntu18.04安装mongodb
    Python开发之日志记录模块:logging
    Git学习笔记:基础篇
    python开发之虚拟环境管理:virtualenv、virtualenvwrapper、pycharm
    Python开发之序列化与反序列化:pickle、json模块使用详解
  • 原文地址:https://www.cnblogs.com/liulaolaiu/p/11744695.html
Copyright © 2011-2022 走看看