System.Threading

定义

提供多线程编程相关类型

描述

包含线程、锁、信号量等多线程编程所需的类,用于实现并发和异步操作

参数

参数名 类型 描述
start ThreadStart 线程启动时执行的方法

返回值

返回值 类型 描述
thread Thread 线程对象

示例

示例代码,创建并启动线程:
using System.Threading;
class Program {
    static void Main() {
        Thread t = new Thread(() => Console.WriteLine("Running in a thread"));
        t.Start();
    }
}