Yes, your callback method executes when a thread pool thread becomes available. For eg, in this example, you can see I'm passing the PooledProc as the call back pointer. This is called when the main thread sleeps.
public static void Main()
{
ThreadPool.QueueUserWorkItem(new WaitCallback(PooledProc));
Console.WriteLine("Main thread");
Thread.Sleep(1000);
Console.WriteLine("Done from Main thread");
Console.ReadLine();
}
// This thread procedure performs the task.
static void PooledProc(Object stateInfo)
{
Console.WriteLine("Pooled Proc");
}
Obviously, the paramter type of QueueUserWorkItem is a WaitCallback delegate type, and if you examine, you may note that the signature of WaitCallBack is like
public delegate void WaitCallback(object state);
The PooleProc method is having the same signature, and hence we can pass the same for the callback.