WebAssembly / wasi-clocks

Clocks API for WASI
40 stars 14 forks source link

Add sleep #18

Closed badeend closed 2 years ago

badeend commented 2 years ago

Like:

sleep: func(duration: u64) -> future<unit>

Returns a future that completes after duration has elapsed.

Thoughts?

sunfishcode commented 2 years ago

This is the intention for the timer functions. The idea is that one creates a timer with new-timer and then use cabi wait to wait for it to complete.

sunfishcode commented 2 years ago

Hmm, it's a good point though that this should now be a future rather than a resource. I'll submit a PR for that.

sunfishcode commented 2 years ago

I've now submitted https://github.com/WebAssembly/wasi-clocks/pull/19 introducing the use of a future, which allows it to work with the new cabi wait design.

badeend commented 2 years ago

Nice. That addresses all my needs, so nothing left for me to discuss here. Closing this while awaiting #19