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);
                }
          }
          
    }
  • 相关阅读:
    习题四 答案
    习题五 答案
    习题三 答案
    习题二 答案
    习题一 答案
    mysqldump 备份
    centos mysql 数据迁移
    常用操作命令
    mysql 日期处理
    thinkphp3.2.3 使用配置
  • 原文地址:https://www.cnblogs.com/king-/p/4389744.html
Copyright © 2011-2022 走看看