Module interval_task::runner
source · Expand description
§Runner
Runner have 2 usage:
- externally call
Runner::close(). - return
trueinTaskWithHandle<T>and runRunner::jointo wait until runner thread exit.
Runner is run inside another thread, but don’t feel bad if you have a !Send or !Sync object needs to be used inside task, you can provide a CtxFunc<T> function, it will be called in runner thread on start, and be passed in task each loop.
§Examples
Checkout test mod under runner
Structs§
- the basic runner the runner can only
Runner::startonce
Functions§
- this function accepts raw impl FnMut if you have func within box, use
Runner::new
Type Aliases§
- This will be executed inside runner thread when started And will be passed as arg to
TaskWithHandle<T> - return
trueto break the loop and stop runner don’t forget you can callRunner::jointo wait for runner thread to finish for arg, seeCtxFunc<T>