.net多线程,线程异步,线程同步,并发问题---1---ShinePans

申请线程,输出线程状态:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace 主线程1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("当前的线程状况:");
            //声明线程变量并赋值为当前线程
            Thread primaryThread = Thread.CurrentThread;
            //赋值线程的名称
            primaryThread.Name = "主线程";
            //显示进程的相关信息
            Console.WriteLine("线程的名字:{0}", primaryThread.Name);
            Console.WriteLine("线程启动状况:{0}", primaryThread.IsAlive);
            Console.WriteLine("线程优先级:{0}", primaryThread.Priority);
            Console.WriteLine("线程状态:{0}", primaryThread.ThreadState);
            Console.ReadLine();
        }
    }
}






posted on 2017-04-12 14:44  blfbuaa  阅读(114)  评论(0编辑  收藏  举报