关于线程的一些东西

进程是每个应用程序的载体

每个应用程序中包含多个线程

进程中第一个被执行的线程叫做主线程

Thread Start;委托 只能用于无返回值无参数的方法后面今年根治写方法名

System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.Threading;//线程

namespace Thread 
{
    class Program
    {
        public static void CallToChildThread()//被子线程调用的意思

        {
            Console.WriteLine("child thread starts");//子类开始
            Thread.Sleep(5000);//简单控制问题 让进程休眠5000毫秒
        }

        static void Main(string[] arge)
        {
            ThreadStart childref = new ThreadStart(CallToChildThread);
            Thread childThread = new Thread(childref);//子线程 固定方法
            childThread.Start();//调用线程真正开始调用的地方
            Thread th = Threadd.CallToChildThread;//访问当前线程
            th.Name = "MainTread";//给线程命名为MainTread
            Console.WriteLine("This is {0}", th.Name);


        }
    }
   
    
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值