summaryrefslogtreecommitdiff
path: root/crates/tor-rtcompat/src/scheduler.rs
Commit message (Collapse)AuthorAgeFilesLines
* smol: Implement smol in tor-rtcompatNiel Duysters2025-08-211-1/+1
|
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-1/+1
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* CI: run miri, currently on tor-rtcompatIan Jackson2024-09-261-0/+1
| | | | | | I'm about to add some unsafe which I want tested in CI. We must disable two tests.
* Temporarily disable it_cancels_delayed_firings.Nick Mathewson2022-11-101-0/+5
| | | | | This test is timing-dependent in a way that seems to fail on heavily loaded CI machines. See #545.
* `TaskSchedule`: give error on `sleep*()` if last handle is droppedNick Mathewson2022-09-071-5/+28
| | | | | | | | | | | | | | | | | | This fixes an busy-loop. When the last `TaskHandle` on a `TaskSchedule` is dropped, the schedule is permanently canceled: whatever operation it was scheduling should no longer be performed. But our code was broken: the `sleep()` and `sleep_until_wallclock()` functions don't verify whether the handles are dropped or not. This breakage caused an CPU-eating busy-loop in `sleep_until_wallclock`. With this patch, we now return a `Result<(), SleepError>` from these functions. Fixes #572.
* tor-rtcompat: s/micros/millis inside a flaky testeta2022-07-261-1/+1
| | | | | | | | | | The other tests wait for 100 milliseconds; this one waits for 100 *microseconds* for some reason, which meant it was understandably flaky if run on anything less than perfect conditions (arti#515). This is probably a typo, so just change it. fixes arti#515
* TaskSchedule: Add a sleep_until_wallclock method too.Nick Mathewson2022-06-101-1/+14
|
* Add a `sleep` function to TaskSchedule.Nick Mathewson2022-06-071-0/+20
| | | | | Having this alias makes it easier to implement more complex schedules, like those used in DirMgr.
* Add "suspend" and "resume" to TaskSchedule.Nick Mathewson2022-06-071-0/+83
| | | | | | Unlike "cancel" and "fire", "suspend" and "resume" don't change any pending timers or events: they just prevent execution of those events for a while, and let them resume later on.
* Make daemon tasks self-contained; introduce NetDirProvidereta2022-03-301-0/+6
| | | | | | | | | | | | | | | The various background daemon tasks that `arti-client` used to spawn are now handled inside their respective crates instead, with functions provided to spawn them that return `TaskHandle`s. This required introducing a new trait, `NetDirProvider`, which steals some functionality from the `DirProvider` trait to enable `tor-circmgr` to depend on it (`tor-circmgr` is a dependency of `tor-dirmgr`, so it can't depend on `DirProvider` directly). While we're at it, we also make some of the tasks wait for events from the `NetDirProvider` instead of sleeping, slightly increasing efficiency.
* tor-rtcompat/scheduler: add unit tests, FireIn -> FireAteta2022-03-241-7/+139
| | | | | Addressing review comments: added some unit tests for the new scheduler type, and made FireIn use an Instant instead (making it FireAt).
* Implement a periodic task scheduler, and a basic dormant modeeta2022-03-231-0/+148
This is a revised version of !397; it implements a scheduling system for periodic tasks that can be externally controlled, and then uses the external control aspect to implement a basic dormant mode (#90). More technically, the scheduling system consists of a `Stream` that periodic tasks are expected to embed in a `while` loop or similar, a way for tasks themselves to choose how long to wait until the stream next yields a result, and a handle to control this outside of the task.