ThreadPool.QueueUserWorkItem Method (System.Threading)

Switch View :
ScriptFree
.NET Framework Class Library
ThreadPool.QueueUserWorkItem Method

Queues a method for execution. The method executes when a thread pool thread becomes available.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

Overload List

  Name Description
Public method Static member QueueUserWorkItem(WaitCallback) Queues a method for execution. The method executes when a thread pool thread becomes available.
Public method Static member QueueUserWorkItem(WaitCallback, Object) Queues a method for execution, and specifies an object containing data to be used by the method. The method executes when a thread pool thread becomes available.
Top
See Also

Reference

Community Content

honeyp0t
re: exceptions
@Tristan2 New exceptions will be thrown until your code crashes.

Tristan2
Exceptions?
When an unhandled exception is thrown from code that was called by QueueUserWorkItem, what happens? How does QueueUserWorkItem handle that exception?

F. Chapleau
Example
private void StartAsync() $0{$0 $0Object state = new Object();$0 $0ThreadPool.QueueUserWorkItem(new WaitCallback(Refresh), state);$0 $0}$0 $0$0 $0 $0private void Refresh(object o)$0 $0{$0 $0// the state is o$0 $0}$0