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

sidevm: Add sidevm:time::maybe_rest() #903

Merged
merged 6 commits into from
Jul 27, 2022
Merged

sidevm: Add sidevm:time::maybe_rest() #903

merged 6 commits into from
Jul 27, 2022

Conversation

kvinwang
Copy link
Collaborator

Guest code can call this API regularly to avoid being stifled.

Copy link
Contributor

@h4x3rotab h4x3rotab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API looks like a blackbox to me. Do you think it's better to make an API that allows the caller to decide the percentage of the remaining gas like this: yield_under_threashold(0.3)? We can make an API with the default value 30% on the guest side.

@kvinwang
Copy link
Collaborator Author

The API looks like a blackbox to me. Do you think it's better to make an API that allows the caller to decide the percentage of the remaining gas like this: yield_under_threashold(0.3)? We can make an API with the default value 30% on the guest side.

I think it's a bit confusing to the caller on how to set the threshold. The take_a_rest_if_needed is already implemented on the guest side. Advanced users can easily implement their own.

BTW, I didn't choose the name yield_ because it sounds like it would require an external resume() to resume the VM.

@h4x3rotab
Copy link
Contributor

OK. Then how about maybe_rest()? It's less verbose than take_a_rest_if_needed.

@kvinwang
Copy link
Collaborator Author

Then how about maybe_rest()? It's less verbose than take_a_rest_if_needed

Sounds OK to me. iOS guys would prefer the verbose one.😄

@kvinwang kvinwang changed the title sidevm: Add take_a_rest_if_needed sidevm: Add sidevm:time::maybe_rest() Jul 27, 2022
@kvinwang kvinwang merged commit e9d7299 into master Jul 27, 2022
@kvinwang kvinwang deleted the take-rest branch July 27, 2022 08:27
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

Successfully merging this pull request may close these issues.

2 participants