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);
                }
          }
          
    }
  • 相关阅读:
    Android Zygote介绍
    Android binder介绍(下)
    Android binder介绍(上)
    Android init介绍(下)
    Android init介绍(上)
    Android 网络服务介绍
    Linux代理服务器使用
    Linux ALSA介绍
    ZigBee MAC层(下)
    ZigBee MAC层(上)
  • 原文地址:https://www.cnblogs.com/king-/p/4389744.html
Copyright © 2011-2022 走看看