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

    //启动线程
    thread = new Thread(new ThreadStart(HelloWorld));
    thread.Start();

    protected void HelloWorld()
    {
    string str ;
    Console.write("helloworld");
    }
    }

    //杀死线程
    if ( thread.IsAlive )
    {
    thread.Abort();
    }

    //暂停线程
    thread.Sleep();

    //设定线程优先级
    //包括Normal, AboveNormal, BelowNormal, Highest, and Lowest几种
    thread.Priority = ThreadPriority.Highest;

    //挂起线程
    if (thread.ThreadState = ThreadState.Running )
    {
    thread.Suspend();
    }

    //唤起线程
    if (thread.ThreadState = ThreadState.Suspended )
    {
    thread.Resume();
    }

  • 相关阅读:
    Leetcode
    算法
    手写代码注意点 -- HashMap
    Batch
    Batch
    Tomcat
    微服务
    Java 基础
    Maven
    算法
  • 原文地址:https://www.cnblogs.com/xlfj521/p/890549.html
Copyright © 2011-2022 走看看