Windows Dev Center

ISignalHandler (delegate) interface

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). Delegates provided to ISignalableNotifier must implement this interface and provide an Invoke method.

Note that the SignalHandler delegate is the projected form of this interface; the two APIs share similar behavior and functionality. Use this interface with ISignalableNotifier and ISignalNotifier, and use the projected form with SignalNotifier.

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

Members

The ISignalHandler interface inherits from the IUnknown interface. ISignalHandler (delegate) also has these types of members:

Methods

The ISignalHandler interface has these methods.

MethodDescription
Invoke

Invoked when the ISignalNotifier is triggered by the waitable object (or by timeout).

 

Examples

The following ISignalHandler delegate behaves differently depending on whether the operation timed out.


//
// ISignalHandler delegate example. Notifies whether a download completes.
//
class ExampleWaitHandler :
    public RuntimeClass<
        RuntimeClassFlags<ClassicCom>,
        ISignalHandler
        >
{
    public:  
  
    HRESULT Invoke (
        _In_ ISignalNotifier * sender,
        BOOLEAN timedOut
        )
    {
        void(sender);
        
        HRESULT hr = S_OK;

        if (timedOut)
        {
            hr = ExampleUIUpdate("Download timed out.");
        }
        else
        {
            hr = ExampleUIUpdate("Download complete.");
        }
        
        return hr;
    }
};

Requirements

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Header

Windows.system.threading.core.h

 

 

Show:
© 2015 Microsoft