https://github.com/ogios/interval-task
Repeatedly execute a "Task" with fixed time delay. more than "setInterval"
https://github.com/ogios/interval-task
multithreading rust setinterval task-scheduler
Last synced: 14 days ago
JSON representation
Repeatedly execute a "Task" with fixed time delay. more than "setInterval"
- Host: GitHub
- URL: https://github.com/ogios/interval-task
- Owner: ogios
- License: mit
- Created: 2024-06-16T03:42:54.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-01-01T06:34:15.000Z (about 1 year ago)
- Last Synced: 2025-10-25T21:46:39.649Z (4 months ago)
- Topics: multithreading, rust, setinterval, task-scheduler
- Language: Rust
- Homepage: https://crates.io/crates/interval-task
- Size: 38.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# interval-task
This crate provides a [`runner`][`crate::runner`] to simulate what [`setInterval`](https://developer.mozilla.org/en-US/docs/Web/API/setInterval) does in JS which is repeatedly executing a task every given [`Duration`][`std::time::Duration`].
But since in rust we can't have that kind of flexibility like js, the runner here provides much more usage except for just pass in the function and delay. Also provide a [channel][`channel`] which wraps up [runner][`crate::runner`]
Please be aware that you have read [`runner`] doc.
This crate uses [`spin_sleep`] which provides accurate sleep. and i optimized to make the loop more accurate.
_Purely thread with no async support_.