One Logo Pool Ball
Dispatch · IOS API REFERENCE

DispatchSourceTimer

protocol · SDK 27.1

protocol DispatchSourceTimer : DispatchSourceProtocol, Sendable

Members (10)

method

scheduleOneshot

Swift declaration
func scheduleOneshot(wallDeadline: DispatchWallTime, leeway: DispatchTimeInterval = .nanoseconds(0))

Sets the deadline and leeway for a timer event that fires once. Once this function returns, any pending source data accumulated for the previous timer values has been cleared and the next timer event will occur at `wallDeadline`. Delivery of the timer event may be delayed by the system in order to improve power consumption and system performance. The upper limit to the allowable delay may be configured with the `leeway` argument; the lower limit is under the control of the system. The lower limit to the allowable delay may vary with process state such as visibility of the application UI. If the timer source was created with flags `TimerFlags.strict`, the system will make a best effort to strictly observe the provided `leeway` value, even if it is smaller than the current lower limit. Note that a minimal amount of delay is to be expected even if this flag is specified. Calling this method has no effect if the timer source has already been canceled. - note: Delivery of the timer event does not cancel the timer source. - parameter wallDeadline: the time at which the timer event will be delivered, subject to the leeway and other considerations described above. The deadline is based on `gettimeofday(3)`. - parameter leeway: the leeway for the timer.

method

scheduleOneshot

Swift declaration
func scheduleOneshot(deadline: DispatchTime, leeway: DispatchTimeInterval = .nanoseconds(0))

Sets the deadline and leeway for a timer event that fires once. Once this function returns, any pending source data accumulated for the previous timer values has been cleared and the next timer event will occur at `deadline`. Delivery of the timer event may be delayed by the system in order to improve power consumption and system performance. The upper limit to the allowable delay may be configured with the `leeway` argument; the lower limit is under the control of the system. The lower limit to the allowable delay may vary with process state such as visibility of the application UI. If the timer source was created with flags `TimerFlags.strict`, the system will make a best effort to strictly observe the provided `leeway` value, even if it is smaller than the current lower limit. Note that a minimal amount of delay is to be expected even if this flag is specified. Calling this method has no effect if the timer source has already been canceled. - note: Delivery of the timer event does not cancel the timer source. - parameter deadline: the time at which the timer event will be delivered, subject to the leeway and other considerations described above. The deadline is based on Mach absolute time. - parameter leeway: the leeway for the timer.

method

scheduleRepeating

Swift declaration
func scheduleRepeating(wallDeadline: DispatchWallTime, interval: DispatchTimeInterval, leeway: DispatchTimeInterval = .nanoseconds(0))

Sets the deadline, interval and leeway for a timer event that fires at least once. Once this function returns, any pending source data accumulated for the previous timer values has been cleared. The next timer event will occur at `wallDeadline` and every `interval` units of time thereafter until the timer source is canceled. Delivery of a timer event may be delayed by the system in order to improve power consumption and system performance. The upper limit to the allowable delay may be configured with the `leeway` argument; the lower limit is under the control of the system. For the initial timer fire at `wallDeadline`, the upper limit to the allowable delay is set to `leeway`. For the subsequent timer fires at `wallDeadline + N * interval`, the upper limit is the smaller of `leeway` and `interval/2`. The lower limit to the allowable delay may vary with process state such as visibility of the application UI. If the timer source was created with flags `TimerFlags.strict`, the system will make a best effort to strictly observe the provided `leeway` value, even if it is smaller than the current lower limit. Note that a minimal amount of delay is to be expected even if this flag is specified. Calling this method has no effect if the timer source has already been canceled. - parameter wallDeadline: the time at which the timer event will be delivered, subject to the leeway and other considerations described above. The deadline is based on `gettimeofday(3)`. - parameter interval: the interval for the timer. - parameter leeway: the leeway for the timer.

method

scheduleRepeating

Swift declaration
func scheduleRepeating(wallDeadline: DispatchWallTime, interval: Double, leeway: DispatchTimeInterval = .nanoseconds(0))

Sets the deadline, interval and leeway for a timer event that fires at least once. Once this function returns, any pending source data accumulated for the previous timer values has been cleared. The next timer event will occur at `wallDeadline` and every `interval` seconds thereafter until the timer source is canceled. Delivery of a timer event may be delayed by the system in order to improve power consumption and system performance. The upper limit to the allowable delay may be configured with the `leeway` argument; the lower limit is under the control of the system. For the initial timer fire at `wallDeadline`, the upper limit to the allowable delay is set to `leeway`. For the subsequent timer fires at `wallDeadline + N * interval`, the upper limit is the smaller of `leeway` and `interval/2`. The lower limit to the allowable delay may vary with process state such as visibility of the application UI. If the timer source was created with flags `TimerFlags.strict`, the system will make a best effort to strictly observe the provided `leeway` value, even if it is smaller than the current lower limit. Note that a minimal amount of delay is to be expected even if this flag is specified. Calling this method has no effect if the timer source has already been canceled. - parameter wallDeadline: the time at which the timer event will be delivered, subject to the leeway and other considerations described above. The deadline is based on `gettimeofday(3)`. - parameter interval: the interval for the timer in seconds. - parameter leeway: the leeway for the timer.

method

scheduleRepeating

Swift declaration
func scheduleRepeating(deadline: DispatchTime, interval: DispatchTimeInterval, leeway: DispatchTimeInterval = .nanoseconds(0))

Sets the deadline, interval and leeway for a timer event that fires at least once. Once this function returns, any pending source data accumulated for the previous timer values has been cleared. The next timer event will occur at `deadline` and every `interval` units of time thereafter until the timer source is canceled. Delivery of a timer event may be delayed by the system in order to improve power consumption and system performance. The upper limit to the allowable delay may be configured with the `leeway` argument; the lower limit is under the control of the system. For the initial timer fire at `deadline`, the upper limit to the allowable delay is set to `leeway`. For the subsequent timer fires at `deadline + N * interval`, the upper limit is the smaller of `leeway` and `interval/2`. The lower limit to the allowable delay may vary with process state such as visibility of the application UI. If the timer source was created with flags `TimerFlags.strict`, the system will make a best effort to strictly observe the provided `leeway` value, even if it is smaller than the current lower limit. Note that a minimal amount of delay is to be expected even if this flag is specified. Calling this method has no effect if the timer source has already been canceled. - parameter deadline: the time at which the timer event will be delivered, subject to the leeway and other considerations described above. The deadline is based on Mach absolute time. - parameter interval: the interval for the timer. - parameter leeway: the leeway for the timer.

method

scheduleRepeating

Swift declaration
func scheduleRepeating(deadline: DispatchTime, interval: Double, leeway: DispatchTimeInterval = .nanoseconds(0))

Sets the deadline, interval and leeway for a timer event that fires at least once. Once this function returns, any pending source data accumulated for the previous timer values has been cleared. The next timer event will occur at `deadline` and every `interval` seconds thereafter until the timer source is canceled. Delivery of a timer event may be delayed by the system in order to improve power consumption and system performance. The upper limit to the allowable delay may be configured with the `leeway` argument; the lower limit is under the control of the system. For the initial timer fire at `deadline`, the upper limit to the allowable delay is set to `leeway`. For the subsequent timer fires at `deadline + N * interval`, the upper limit is the smaller of `leeway` and `interval/2`. The lower limit to the allowable delay may vary with process state such as visibility of the application UI. If the timer source was created with flags `TimerFlags.strict`, the system will make a best effort to strictly observe the provided `leeway` value, even if it is smaller than the current lower limit. Note that a minimal amount of delay is to be expected even if this flag is specified. Calling this method has no effect if the timer source has already been canceled. - parameter deadline: the time at which the timer event will be delivered, subject to the leeway and other considerations described above. The deadline is based on Mach absolute time. - parameter interval: the interval for the timer in seconds. - parameter leeway: the leeway for the timer.

method

schedule

Swift declaration
func schedule(wallDeadline: DispatchWallTime, repeating interval: DispatchTimeInterval = .never, leeway: DispatchTimeInterval = .nanoseconds(0))

Sets the deadline, repeat interval and leeway for a timer event. Once this function returns, any pending source data accumulated for the previous timer values has been cleared. The next timer event will occur at `wallDeadline` and every `repeating` units of time thereafter until the timer source is canceled. If the value of `repeating` is `.never`, or is defaulted, the timer fires only once. Delivery of a timer event may be delayed by the system in order to improve power consumption and system performance. The upper limit to the allowable delay may be configured with the `leeway` argument; the lower limit is under the control of the system. For the initial timer fire at `wallDeadline`, the upper limit to the allowable delay is set to `leeway`. For the subsequent timer fires at `wallDeadline + N * repeating`, the upper limit is the smaller of `leeway` and `repeating/2`. The lower limit to the allowable delay may vary with process state such as visibility of the application UI. If the timer source was created with flags `TimerFlags.strict`, the system will make a best effort to strictly observe the provided `leeway` value, even if it is smaller than the current lower limit. Note that a minimal amount of delay is to be expected even if this flag is specified. Calling this method has no effect if the timer source has already been canceled. - parameter wallDeadline: the time at which the timer event will be delivered, subject to the leeway and other considerations described above. The deadline is based on `gettimeofday(3)`. - parameter repeating: the repeat interval for the timer, or `.never` if the timer should fire only once. - parameter leeway: the leeway for the timer.

method

schedule

Swift declaration
func schedule(wallDeadline: DispatchWallTime, repeating interval: Double, leeway: DispatchTimeInterval = .nanoseconds(0))

Sets the deadline, repeat interval and leeway for a timer event that fires at least once. Once this function returns, any pending source data accumulated for the previous timer values has been cleared. The next timer event will occur at `wallDeadline` and every `repeating` seconds thereafter until the timer source is canceled. If the value of `repeating` is `.infinity`, the timer fires only once. Delivery of a timer event may be delayed by the system in order to improve power consumption and system performance. The upper limit to the allowable delay may be configured with the `leeway` argument; the lower limit is under the control of the system. For the initial timer fire at `wallDeadline`, the upper limit to the allowable delay is set to `leeway`. For the subsequent timer fires at `wallDeadline + N * repeating`, the upper limit is the smaller of `leeway` and `repeating/2`. The lower limit to the allowable delay may vary with process state such as visibility of the application UI. If the timer source was created with flags `TimerFlags.strict`, the system will make a best effort to strictly observe the provided `leeway` value, even if it is smaller than the current lower limit. Note that a minimal amount of delay is to be expected even if this flag is specified. Calling this method has no effect if the timer source has already been canceled. - parameter wallDeadline: the time at which the timer event will be delivered, subject to the leeway and other considerations described above. The deadline is based on `gettimeofday(3)`. - parameter repeating: the repeat interval for the timer in seconds, or `.infinity` if the timer should fire only once. - parameter leeway: the leeway for the timer.

method

schedule

Swift declaration
func schedule(deadline: DispatchTime, repeating interval: DispatchTimeInterval = .never, leeway: DispatchTimeInterval = .nanoseconds(0))

Sets the deadline, repeat interval and leeway for a timer event. Once this function returns, any pending source data accumulated for the previous timer values has been cleared. The next timer event will occur at `deadline` and every `repeating` units of time thereafter until the timer source is canceled. If the value of `repeating` is `.never`, or is defaulted, the timer fires only once. Delivery of a timer event may be delayed by the system in order to improve power consumption and system performance. The upper limit to the allowable delay may be configured with the `leeway` argument; the lower limit is under the control of the system. For the initial timer fire at `deadline`, the upper limit to the allowable delay is set to `leeway`. For the subsequent timer fires at `deadline + N * repeating`, the upper limit is the smaller of `leeway` and `repeating/2`. The lower limit to the allowable delay may vary with process state such as visibility of the application UI. If the timer source was created with flags `TimerFlags.strict`, the system will make a best effort to strictly observe the provided `leeway` value, even if it is smaller than the current lower limit. Note that a minimal amount of delay is to be expected even if this flag is specified. Calling this method has no effect if the timer source has already been canceled. - parameter deadline: the time at which the first timer event will be delivered, subject to the leeway and other considerations described above. The deadline is based on Mach absolute time. - parameter repeating: the repeat interval for the timer, or `.never` if the timer should fire only once. - parameter leeway: the leeway for the timer.

method

schedule

Swift declaration
func schedule(deadline: DispatchTime, repeating interval: Double, leeway: DispatchTimeInterval = .nanoseconds(0))

Sets the deadline, repeat interval and leeway for a timer event. Once this function returns, any pending source data accumulated for the previous timer values has been cleared. The next timer event will occur at `deadline` and every `repeating` seconds thereafter until the timer source is canceled. If the value of `repeating` is `.infinity`, the timer fires only once. Delivery of a timer event may be delayed by the system in order to improve power consumption and system performance. The upper limit to the allowable delay may be configured with the `leeway` argument; the lower limit is under the control of the system. For the initial timer fire at `deadline`, the upper limit to the allowable delay is set to `leeway`. For the subsequent timer fires at `deadline + N * repeating`, the upper limit is the smaller of `leeway` and `repeating/2`. The lower limit to the allowable delay may vary with process state such as visibility of the application UI. If the timer source was created with flags `TimerFlags.strict`, the system will make a best effort to strictly observe the provided `leeway` value, even if it is smaller than the current lower limit. Note that a minimal amount of delay is to be expected even if this flag is specified. Calling this method has no effect if the timer source has already been canceled. - parameter deadline: the time at which the timer event will be delivered, subject to the leeway and other considerations described above. The deadline is based on Mach absolute time. - parameter repeating: the repeat interval for the timer in seconds, or `.infinity` if the timer should fire only once. - parameter leeway: the leeway for the timer.

Skipped declarations

No declarations were skipped in this snapshot.

All Dispatch types →