什么是WaitCallback委托的确切目的?
What is the exact purpose of WaitCallback delegate ?
WaitCallback callback = new WaitCallback(PrintMessage);
ThreadPool.QueueUserWorkItem(callback,"Hello");
static void PrintMessage(object obj)
{
Console.WriteLine(obj);
}
我可以的意思是等待中的TheadPool,直到线程是availabe.Once它可以执行 目标?的
Can i mean "Wait" in the "TheadPool" until thread is availabe.Once it is available execute the target?
在WaitCallback在这种情况下再presents一个指向将在从线程池中的线程执行的函数。如果没有线程可用它会等到一个得到释放。
The WaitCallback in this case represents a pointer to a function that will be executed on a thread from the thread pool. If no thread is available it will wait until one gets freed.