小编vik*_*ram的帖子

System.Threading.Timer

当我们使用System.Threading.Timer时,那么在创建计时器的线程上执行的方法是什么?或者是在另一个线程中执行?

class Timer
{
    static void Main()
    {
        TimerCallback tcall = statusChecker.CheckStatus;
        Timer stateTimer = new Timer(tcb, autoEvent, 1000, 250);
    }
}
class StatusChecker
{
    public void CheckStatus(Object stateInfo)
    {
    }
}
Run Code Online (Sandbox Code Playgroud)

我的问题是,如果timer delegate(CheckStatus)调用的方法是在主线程中执行还是在另一个线程中执行?

c# multithreading timer

7
推荐指数
1
解决办法
2312
查看次数

标签 统计

c# ×1

multithreading ×1

timer ×1