Export (0) Print
Expand All
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Windows.System.Threading.Core namespace

Applies to Windows and Windows Phone

Creates work items that run in response to named events and semaphores. Also preallocates resources for work items that must be guaranteed the ability to run, even in circumstances of heavy (or full) resource allocation.

Note  The ThreadPool API is supported for desktop as well as Windows Store apps.


When work items are created using ThreadPool.RunAsync, the work item is created and submitted as a single operation. This is acceptable for most scenarios, but it is sometimes necessary to set aside resources for a work item in advance.

The PreallocatedWorkItem class constructs a work item ahead of time, putting the work item "on standby" so that it can be submitted to the thread pool when it's needed. This is useful in circumstances where the resources available to your app are completely allocated before the work item is needed - for example, calling a deallocation routine that uses a work item. If a work item has already been allocated, the resource deallocation routine can still be called and the PreallocatedWorkItem can still be submitted to the thread pool even if all resources are already in use.


Sometimes it is necessary to queue work items in response to named events or semaphores created by Win32 COM objects. You can run a Windows Runtime method in response to a named event or semaphore using a SignalNotifier object. This allows you to write Windows Runtime code that responds to events and signals sent using Win32 and COM for Windows Store apps, provided that the event or semaphore has a name. For example, the SignalNotifier can be used to work with Win32 code that's being ported to a Windows Store app.


Occasionally it is not possible to know the name of an event or semaphore, but your app still needs to respond to it; for example legacy code, and some well-known events and semaphores, still use waitable handles instead of names. ISignalableNotifier allows you to create ISignalNotifier objects registered with waitable handles.

Note  Preallocated work items are only needed for apps that may use up all available resources, or that need to create work items for resource deallocation routines. Signal notifiers are only applicable to certain apps that use Win32 and COM for Windows Store apps. If you don't need to use preallocation or signaling in your app, create work items by using Windows.System.Threading.


The Windows.System.Threading.Core namespace has these types of members:


The Windows.System.Threading.Core namespace has these classes.

PreallocatedWorkItem A preallocated work item is constructed in advance of its submission to the thread pool, ensuring that the work item is constructed so that it can be submitted to the thread pool when necessary. For example, a PreallocatedWorkItem can be created in case it is needed for a resource deallocation routine, since the resource deallocation routine may be called in circumstances when not enough resources would be available to create the work item.
SignalNotifier Runs a method when an event or semaphore is signaled. A timeout value can also be specified, causing the delegate to run after the time span has elapsed if the named event does not occur (or if the semaphore does not reach a signaled state).



The Windows.System.Threading.Core namespace has these delegates.

SignalHandler Represents a method that is called when a signal notifier's attached event or semaphore is signaled, or when the optional timeout value has elapsed (whichever comes first).



The Windows.System.Threading.Core namespace defines these interfaces.

ISignalHandler <delegate>



Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8


Windows::System::Threading::Core [C++]





© 2014 Microsoft