-
Notifications
You must be signed in to change notification settings - Fork 26
Tracking issue: timer bindings #62
Comments
@luover how about *nix and examples? |
@kpp I find it has some linux support now |
@luover oh wow, that looks great. Very clean. Thanks for sharing! |
@tinaun's crate looks great to me. :) It makes me wonder about what the boundary is for abstracting over different timer sources. tokio-timer provides two futures and two streams: delay, interval, timeout, and delayqueue. futures-native-timers provides only the first two. Timeout can be fairly trivially implemented by combining select and delay, and i suspect delayqueue is similarly possible to construct by combining concurrency primitives with delay. I wonder, also, about interval: at the levels of precision we care about, could it it not be written by triggering a delay repeatedly? In other words, it seems like the "abstraction boundary" between timers and the rest of the ecosystem could just be |
I believe the approach that should be adopted to timers is to provide generic Therefore I started working on generic facilities for async https://github.com/DoumanAsh/async-timer For now it has |
i don't really feel like a timer implementation is the right place for trait based generics. individual future runtimes could have ways of choosing from several different timers, but i don't feel like a top level trait is a good fit for them |
@tinaun How end-user future that depends on timer is going to choose timer implementation? Or do you mean at compile time? It is not flexible, the whole point of customization through underlying |
the generic trait for abstracting over different timer sources already exists, its called Future! |
But well for sub-set of problems it can be used too I guess |
"I wonder, also, about interval: at the levels of precision we care about, could it it not be written by triggering a delay repeatedly." This all exists harmoniously from core to crate to design patterns fir apps. It's mlti-leveled of course. A link and a question link: Quote:
End quote. You must meet all these requirements in a Rusty perfromant manner. I support your suggestion as a Trait but wonder about dirty memory reads that reflect a false state: I don't see any issues here or with Rust. |
From talking with @withoutboats: it would make sense to create a timer implementation on top of OS timers. I'm not quite sure yet how this should work, but a cursory search shows that there's multiple options available on unix through
timer_create(2)
andepoll(2)
with a timeout parameter. I'm not sure yet about Windows.References
The text was updated successfully, but these errors were encountered: