Skip to content

Commit

Permalink
Fix some typos in ch02-02-timers.md
Browse files Browse the repository at this point in the history
  • Loading branch information
guhwanbae authored and elinorbgr committed Nov 22, 2023
1 parent 6e276f6 commit c6f6b88
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion doc/src/ch02-02-timers.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Breaking this down, the callback we provide receives 3 arguments:
In addition your callback is expected to return a [`TimeoutAction`](api/calloop/timer/enum.TimeoutAction.html), that will instruct calloop what to do next. This enum has 3 values:

- `Drop` will disable the timer and destroy it, freeing the callback.
- `ToInstant` will rechedule the callback to fire again at given `Instant`, invoking the same callback again. This is useful if you need to create a timer that fires events at regular intervals, for example to encode key repetition in a graphical app. You would compute the next instant by adding the duration to the previous instant. It is not a problem if that duration is in the past, it'll simply cause the timer to fire again instantly. THis way, even if some other part of your app lags, you'll still have on average the correct amount of events per second.
- `ToInstant` will reschedule the callback to fire again at given `Instant`, invoking the same callback again. This is useful if you need to create a timer that fires events at regular intervals, for example to encode key repetition in a graphical app. You would compute the next instant by adding the duration to the previous instant. It is not a problem if that duration is in the past, it'll simply cause the timer to fire again instantly. This way, even if some other part of your app lags, you'll still have on average the correct amount of events per second.
- `ToDuration` will reschedule the callback to fire again after a given `Duration`. This is useful if you need to schedule some background task to execute again after some time after it was last completed, when there is no point in catching up some previous lag.

## The whole program
Expand Down

0 comments on commit c6f6b88

Please sign in to comment.