SignalNotifier SignalNotifier SignalNotifier Class

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).

Note

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

Syntax

Declaration

public sealed class SignalNotifierpublic sealed class SignalNotifierPublic NotInheritable Class SignalNotifier

Methods summary

Attaches a SignalHandler delegate to an event. The delegated method will run the next time the event occurs.

Attaches a SignalHandler delegate to an event. The delegated method will run if the event occurs or the time span elapses, whichever comes first.

Attaches a SignalHandler delegate to a named semaphore. The delegated method will run when the named semaphore is signaled.

Attaches a SignalHandler delegate to a named semaphore and specifies a timeout value. The delegated method will run when the named semaphore is signaled, or if the time span elapses before the semaphore reaches a signaled state.

Submits the SignalNotifier to the thread pool.

Terminates the SignalNotifier if it has not already started running.

Methods

  • AttachToEvent(String, SignalHandler)
    AttachToEvent(String, SignalHandler)
    AttachToEvent(String, SignalHandler)
    AttachToEvent(String, SignalHandler)

    Attaches a SignalHandler delegate to an event. The delegated method will run the next time the event occurs.

    public static SignalNotifier AttachToEvent(String name, SignalHandler handler)public static SignalNotifier AttachToEvent(String name, SignalHandler handler)Public Static Function AttachToEvent(name As String, handler As SignalHandler) As SignalNotifierpublic static SignalNotifier AttachToEvent(String name, SignalHandler handler)

    Parameters

    • name
      System.String
      System.String
      System.String

      Indicates the event that causes the method to run.

    • handler

      Indicates the method that will run in response to the event.

    Returns

  • AttachToEvent(String, SignalHandler, TimeSpan)
    AttachToEvent(String, SignalHandler, TimeSpan)
    AttachToEvent(String, SignalHandler, TimeSpan)
    AttachToEvent(String, SignalHandler, TimeSpan)

    Attaches a SignalHandler delegate to an event. The delegated method will run if the event occurs or the time span elapses, whichever comes first.

    public static SignalNotifier AttachToEvent(String name, SignalHandler handler, TimeSpan timeout)public static SignalNotifier AttachToEvent(String name, SignalHandler handler, TimeSpan timeout)Public Static Function AttachToEvent(name As String, handler As SignalHandler, timeout As TimeSpan) As SignalNotifierpublic static SignalNotifier AttachToEvent(String name, SignalHandler handler, TimeSpan timeout)

    Parameters

    • name
      System.String
      System.String
      System.String

      Indicates the event that causes the method to run.

    • handler

      Indicates the method that will run in response to the event, or when the time span elapses, whichever comes first.

    • timeout

      Indicates the amount of time to continue waiting for the event before running the handler method.

    Returns

  • AttachToSemaphore(String, SignalHandler)
    AttachToSemaphore(String, SignalHandler)
    AttachToSemaphore(String, SignalHandler)
    AttachToSemaphore(String, SignalHandler)

    Attaches a SignalHandler delegate to a named semaphore. The delegated method will run when the named semaphore is signaled.

    public static SignalNotifier AttachToSemaphore(String name, SignalHandler handler)public static SignalNotifier AttachToSemaphore(String name, SignalHandler handler)Public Static Function AttachToSemaphore(name As String, handler As SignalHandler) As SignalNotifierpublic static SignalNotifier AttachToSemaphore(String name, SignalHandler handler)

    Parameters

    • name
      System.String
      System.String
      System.String

      Names the semaphore that signals the method to run.

    • handler

      Indicates the delegate that will run in response to the named semaphore entering the signaled state.

    Returns

  • AttachToSemaphore(String, SignalHandler, TimeSpan)
    AttachToSemaphore(String, SignalHandler, TimeSpan)
    AttachToSemaphore(String, SignalHandler, TimeSpan)
    AttachToSemaphore(String, SignalHandler, TimeSpan)

    Attaches a SignalHandler delegate to a named semaphore and specifies a timeout value. The delegated method will run when the named semaphore is signaled, or if the time span elapses before the semaphore reaches a signaled state.

    public static SignalNotifier AttachToSemaphore(String name, SignalHandler handler, TimeSpan timeout)public static SignalNotifier AttachToSemaphore(String name, SignalHandler handler, TimeSpan timeout)Public Static Function AttachToSemaphore(name As String, handler As SignalHandler, timeout As TimeSpan) As SignalNotifierpublic static SignalNotifier AttachToSemaphore(String name, SignalHandler handler, TimeSpan timeout)

    Parameters

    • name
      System.String
      System.String
      System.String

      Names the semaphore that signals the method to run.

    • handler

      Indicates the delegate that will run in response to the named semaphore entering the signaled state.

    • timeout

      Indicates the amount of time to continue waiting for the named semaphore before running the delegate.

    Returns

  • Enable()
    Enable()
    Enable()
    Enable()

    Submits the SignalNotifier to the thread pool.

    public void Enable()public void Enable()Public Function Enable() As voidpublic void Enable()
  • Terminate()
    Terminate()
    Terminate()
    Terminate()

    Terminates the SignalNotifier if it has not already started running.

    public void Terminate()public void Terminate()Public Function Terminate() As voidpublic void Terminate()

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.ThreadingAttribute
Windows.Foundation.Metadata.WebHostHiddenAttribute

Details

Assembly

Windows.System.Threading.Core.dll