zoukankan      html  css  js  c++  java
  • 线程Join_yield

    package com.Thread;
     
    public class Jion_yield {
           public static void main(String[] args) throws Exception {
                Test tes = new Test();
                Thread t = new Thread(tes);
                t.start();
                
                 for(int i = 0; i<1000; i++) {
    //                if(i==200) {
                             //合并线程
    //                      t.join();
    //                }
                       if(i%20==0) {
                             //暂停本线程
                            Thread. yield();
                      }
                      System. out.println("main+++++" + i);
                }
          }
    }
    class Test implements Runnable{
           @Override
           public void run() {
                 for(int i=0; i<1000; i++) {
                      System. out.println("Test...." + i);
                }
          }
          
    }
  • 相关阅读:
    [C]recursion递归计算阶乘
    [Python]reduce function & lambda function & factorial
    [C/JAVA] ceil, floor
    OC项目调用C++
    Xcode 代码注释
    百度云加速器
    UITableView和MJReFresh结合使用问题记录
    OC 类的load方法
    JLRoutes笔记
    推送通知项目记录
  • 原文地址:https://www.cnblogs.com/king-/p/4389744.html
Copyright © 2011-2022 走看看