Skip to content

libtock_unittest: make Yield invoke queued upcalls.#330

Merged
bors[bot] merged 2 commits intotock:masterfrom
jrvanwhy:invoke-upcalls
Sep 12, 2021
Merged

libtock_unittest: make Yield invoke queued upcalls.#330
bors[bot] merged 2 commits intotock:masterfrom
jrvanwhy:invoke-upcalls

Conversation

@jrvanwhy
Copy link
Collaborator

@jrvanwhy jrvanwhy commented Sep 5, 2021

With this PR, calling the Yield system calls will correctly invoke queued upcalls. This PR and #329 implement the fake Subscribe implementation in libtock_unittest.

@jrvanwhy jrvanwhy added the significant Indicates a PR is significant as defined by the code review policy. label Sep 5, 2021
@jrvanwhy jrvanwhy mentioned this pull request Sep 5, 2021
18 tasks
Copy link
Contributor

@hudson-ayers hudson-ayers left a comment

Choose a reason for hiding this comment

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

Looks good, but one comment

// Pops the next upcall off the kernel data's upcall queue and invokes it, or
// does nothing if the upcall queue was entry. The return value indicates
// whether an upcall was run. Panics if no kernel data is present.
fn invoke_next_upcall() -> libtock_platform::YieldNoWaitReturn {
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems to me that this should just return a bool indicating whether an upcall was invoked. It seems strange to return YieldNoWaitReturn when this method is also called in response to yield-wait

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I used YieldNoWaitReturn because it had the values I needed, but I agree the name is confusing. I changed to bool as you suggested.

I also replaced the if X { panic!(); } pattern with assert!(X, "...").

Returning `YieldNoWaitReturn` was confusing because `invoke_next_upcall` is used by both yield-wait and yield-no-wait.
@jrvanwhy
Copy link
Collaborator Author

bors r+

@bors
Copy link
Contributor

bors bot commented Sep 12, 2021

Build succeeded:

@bors bors bot merged commit 1decbbd into tock:master Sep 12, 2021
@jrvanwhy jrvanwhy deleted the invoke-upcalls branch February 5, 2022 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

significant Indicates a PR is significant as defined by the code review policy.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants