相关疑难解决方法(0)

Thread.Sleep(1)在C#中有什么影响?

在Windows窗体应用程序中,调用的影响Thread.Sleep(1)如下面的代码所示:

public Constructor()
{
    Thread thread = new Thread(Task);
    thread.IsBackground = true;
    thread.Start();
}

private void Task()
{
    while (true)
    {
        // do something
        Thread.Sleep(1);
    }
}
Run Code Online (Sandbox Code Playgroud)

这个线程会占用所有可用的CPU吗?

我可以使用哪些分析技术来测量此线程的CPU使用率(除了任务管理器)?

c# multithreading

29
推荐指数
4
解决办法
3万
查看次数

标签 统计

c# ×1

multithreading ×1