Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo Hello World setTimeout() does not seem to be working #87

Open
vishalchandra opened this issue Oct 11, 2022 · 5 comments
Open

Demo Hello World setTimeout() does not seem to be working #87

vishalchandra opened this issue Oct 11, 2022 · 5 comments
Assignees

Comments

@vishalchandra
Copy link

vishalchandra commented Oct 11, 2022

This does not seem to be working from this example on OSX

setTimeout(() => {
    print('timeout 2s');
}, 2000);

Originally posted by @vishalchandra in #62 (comment)

@L-jasmine
Copy link
Collaborator

@vishalchandra Please provide error message.

@vishalchandra
Copy link
Author

It does not throw an error.

wasmedge --dir .:. wasmedge-quickjs/target/wasm32-wasi/release/wasmedge_quickjs.wasm wasmedge-quickjs/example_js/hello.js WasmEdge Runtime
Hello WasmEdge Runtime

The print works and it reads the arguments from the command line, but ignores the timeout function.

The following output is expected

Hello WasmEdge Runtime
timeout 2s

I think this is OSX specific issue, so probably related to WASI (within Wasmedge runtime) working on OSX in terms of the os / time processes. I am not sure how to go about fixing that.

@L-jasmine
Copy link
Collaborator

@hydai can you check OSX poll_oneoff?

@hydai
Copy link
Member

hydai commented Oct 13, 2022

@hydai can you check OSX poll_oneoff?

Do we have minimum reproduction steps for evaluating this? The unit test of the poll_oneoff on the GitHub workflow is green.

@L-jasmine
Copy link
Collaborator

@hydai can you check OSX poll_oneoff?

Do we have minimum reproduction steps for evaluating this? The unit test of the poll_oneoff on the GitHub workflow is green.

fn as_subscription(&self, index: usize) -> Subscription {
let nanoseconds = self.timeout;
poll::Subscription {
userdata: index as u64,
u: poll::SubscriptionU {
tag: poll::EVENTTYPE_CLOCK,
u: poll::SubscriptionUU {
clock: poll::SubscriptionClock {
id: poll::CLOCKID_REALTIME,
timeout: nanoseconds as u64,
precision: 0,
flags: poll::SUBCLOCKFLAGS_SUBSCRIPTION_CLOCK_ABSTIME,
},
},
},
}
}

I guess the problem is here. SUBCLOCKFLAGS_SUBSCRIPTION_CLOCK_ABSTIME

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants