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);

        }







  • 相关阅读:
    Objective-C之NSArray(数组)默认排序与自定义排序
    Objective-C学习笔记之for( int )机制
    OC之NSString、NSMutableString学习笔记 常用方法
    换行回车的区别 2018-10-30
    Python头部2行 #!/usr/bin/python 和 #!/usr/bin/env 的区别 以及编码方式的指定 2018-10-23
    旧版Windows 睡眠与休眠 2018-10-18
    手机尺寸像素 PPI 2018-10-17
    VMvare 虚拟机扩容 2018-10-11
    批量判断网址能否访问 2018-10-04
    字符串的 strip()方法 2018-10-04
  • 原文地址:https://www.cnblogs.com/liulaolaiu/p/11744695.html
Copyright © 2011-2022 走看看