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

Design a poll-based interface #34

Open
axic opened this issue Aug 10, 2016 · 5 comments
Open

Design a poll-based interface #34

axic opened this issue Aug 10, 2016 · 5 comments

Comments

@axic
Copy link
Member

axic commented Aug 10, 2016

In case WASM will not support asynchronous methods we might need to take an alternative approach.

A simple way is to have each operation work with polling, storageLoad would become:

  • ethereum.storageLoad(args)
  • ethereum.storageLoadResult() -> i32 (where 1 means result is written to the specified memory location)

And the following pseudocode in WASM:

ethereum.storageLoad()
do { 
  result = ethereum.storageLoadResult()
} while(!result)

The JS interface would need to do the sleep then. It's not efficient at all, but there's no way to sleep in WASM.

@wanderer
Copy link
Member

wanderer commented Aug 10, 2016

related WebAssembly/design#720

@wanderer
Copy link
Member

wanderer commented Aug 10, 2016

The JS interface would need to do the sleep then.

I think This is really more an implementation problem with the current JS prototype. We can assume that other implementations have full control over their VM

@wanderer
Copy link
Member

related WebAssembly/design#720

@wanderer
Copy link
Member

also an alternative would be to use a callback based interface #48

@wanderer
Copy link
Member

related ewasm/ewasm-kernel#2

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

No branches or pull requests

2 participants