Event

public final class Event: Lock

A thread event object. Inherits from Threading.Lock. The event MUST be locked before wait or signal is called. While inside the wait call, the event is automatically placed in the unlocked state. After wait or signal return the event will be in the locked state and must be unlocked.

  • Initialize a new Event object.

    Declaration

    Swift

    override public init()
  • Signal at most ONE thread which may be waiting on this event. Has no effect if there is no waiting thread.

    Declaration

    Swift

    public func signal() -> Bool
  • Signal ALL threads which may be waiting on this event. Has no effect if there is no waiting thread.

    Declaration

    Swift

    public func broadcast() -> Bool
  • Wait on this event for another thread to call signal. Blocks the calling thread until a signal is received or the timeout occurs. Returns true only if the signal was received. Returns false upon timeout or error.

    Declaration

    Swift

    public func wait(seconds secs: Double = Threading.noTimeout) -> Bool