System.Threading.WaitCallback Delegate

Represents a callback method to be executed by a thread pool thread.

Syntax

[System.Runtime.InteropServices.ComVisible(true)]
public delegate void WaitCallback (object state)

Parameters

state
Documentation for this section has not yet been entered.

Remarks

System.Threading.WaitCallback represents a callback method that you want to execute on a System.Threading.ThreadPool thread. Create the delegate by passing your callback method to the System.Threading.WaitCallback constructor. Your method must have the signature shown here.

Queue your task for execution by passing the System.Threading.WaitCallback delegate to ThreadPool.QueueUserWorkItem(WaitCallback, object). Your callback method executes when a thread pool thread becomes available.

[Visual Basic]

Note:

Visual Basic users can omit the System.Threading.WaitCallback constructor, and simply use the AddressOf operator when passing the callback method to ThreadPool.QueueUserWorkItem(WaitCallback, object). Visual Basic automatically calls the correct delegate constructor.

If you want to pass information to your callback method, create an object that contains the necessary information and pass it to ThreadPool.QueueUserWorkItem(WaitCallback, object) when you queue your task for execution. Each time your callback method executes, the state parameter contains this object.

For more information about using callbacks to synchronize thread pool threads, see [<topic://cpconthreadpooling>].

Requirements

Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0