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

Implement rclnodejs.spinOnce #563

Merged
merged 2 commits into from
Feb 17, 2020
Merged

Implement rclnodejs.spinOnce #563

merged 2 commits into from
Feb 17, 2020

Conversation

mattrichard
Copy link
Collaborator

Adds spinOnce support to rclnodejs. Unlike spin which runs in a separate thread, spinOnce will run synchronously and block the caller until the event loop has finished or times-out. Ideally, this should result in more predictable execution of unit tests that rely on the event loop. spinOnce cannot be used if already spinning and will throw error if attempted.

Usage:

let node = rclnodejs.createNode('my_node');
rclnodejs.spinOnce(node);

Fix #562

Copy link
Member

@minggangw minggangw left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, LGTM!

return status != RCL_RET_WAIT_SET_EMPTY;
}

void Executor::ExecuteReadyHandles() {
Copy link
Member

Choose a reason for hiding this comment

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

It's so nice to encapsulate these functions.

@minggangw minggangw merged commit 9db8939 into RobotWebTools:develop Feb 17, 2020
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.

Support spin once
2 participants