Skip to content

Latest commit

 

History

History
28 lines (18 loc) · 3.16 KB

windows_system_threading_core.md

File metadata and controls

28 lines (18 loc) · 3.16 KB
-api-id -api-type
N:Windows.System.Threading.Core
winrt namespace

Windows.System.Threading.Core

-description

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 UWP apps.

PreallocatedWorkItemWhen 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 , 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 UWP app. ISignalableNotifierOccasionally 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 . If you don't need to use preallocation or signaling in your app, create work items by using Windows.System.Threading.

-remarks

-examples

-see-also