ISignalableNotifier interface
Creates ISignalNotifier objects that invoke methods in response to an event or semaphore specified by handle. Use this interface to create ISignalNotifier objects by providing a waitable handle, an ISignalHandler delegate, and (optionally) a timeout value.
ISignalableNotifier is a classic COM interface. Use CoCreateInstance to create a new ISignalableNotifier and store it in a ComPtr wrapper. For more info see the example later in this topic.
Members
The ISignalableNotifier interface inherits from the IUnknown interface. ISignalableNotifier also has these types of members:
Methods
The ISignalableNotifier interface has these methods.
| Method | Description |
|---|---|
| AttachToWaitHandle |
Use this function to attach to a waitable handle. |
| AttachToWaitHandleWithTimeout |
Use this function to attach to a waitable handle and specify a timeout value. |
Using the WinRT threadpool with waitable handles
Use the ISignalableNotifier interface to create ISignalNotifier objects.
First create the factory by using CoCreateInstance:
#include <windows.system.threading.core.h> #include <tpwaitablehandle.h> using namespace Windows::System::Threading::Core; using namespace ABI::Windows::System::Threading::Core; HRESULT hr; ComPtr<ISignalableNotifier> SignalableNotifierFactory; hr = CoCreateInstance( __uuidof(SignalableNotifier), nullptr, CLSCTX_INPROC_SERVER, __uuidof(ISignalableNotifier), reinterpret_cast<void**>(SignalableNotifierFactory.ReleaseAndGetAddressOf()) );
If the factory was successfully created (CoCreateInstance returned S_OK), then call one of the ISignalableNotifier methods to create a signal notifier that responds to a waitable handle. Provide a waitable handle and provide your ISignalHandler delegate.
// Stores the signal notifier created by the factory. ComPtr<ABI::Windows::System::Threading::Core::ISignalNotifier> comWaitHandle; // TODO: Create your own ISignalHandler class ComPtr<ISignalHandler> exampleHandler; // TODO: Provide a waitable handle. HANDLE exampleEvent; hr = SignalableNotifierFactory->AttachToWaitHandle( (HANDLE_PTR)exampleEvent, handler.Get(), NULL, __uuidof(ABI::Windows::System::Threading::Core::ISignalNotifier), reinterpret_cast<void**>(comWaitHandle.ReleaseAndGetAddressOf()) );
Requirements
|
Minimum supported client |
Windows 8 [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows Server 2012 [desktop apps only] |
|
Target platform | |
|
Header |
|