Stream: wasm

Topic: ✔ To sleep, use a busy loop


view this post on Zulip Scott Waye (Feb 07 2022 at 22:56):

To pause for some seconds, would I just create a busy loop checking clock_time_get ?

view this post on Zulip Scott Waye (Feb 07 2022 at 22:56):

I.e. with WASI

view this post on Zulip Scott Waye (Feb 07 2022 at 22:57):

Doesn't matter if the CPU is knackered while doing this, at least not in my scenario

view this post on Zulip Dan Gohman (Feb 07 2022 at 23:00):

You can use poll with just a clock timeout

view this post on Zulip Scott Waye (Feb 07 2022 at 23:14):

From #include <poll.h> and just let the wasi-sdk's libc look after how that's implemented? I'm coming from C# but I could still do this.

view this post on Zulip Dan Gohman (Feb 07 2022 at 23:17):

If you have access to WASI libc, you can also just use sleep, nanosleep, etc.

view this post on Zulip Dan Gohman (Feb 07 2022 at 23:17):

which work in terms of poll

view this post on Zulip Dan Gohman (Feb 07 2022 at 23:18):

<poll.h> and calling poll would also work

view this post on Zulip Scott Waye (Feb 07 2022 at 23:20):

I see, ultimately, they go to __wasi_poll_oneoff

view this post on Zulip Scott Waye (Feb 07 2022 at 23:22):

that looks interesting. Thanks

view this post on Zulip Notification Bot (Feb 07 2022 at 23:22):

Scott Waye has marked this topic as resolved.


Last updated: Nov 22 2024 at 17:03 UTC