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

Align examples and remove reading from stdin #768

Merged
merged 5 commits into from
Mar 13, 2024

Conversation

oteffahi
Copy link
Contributor

@oteffahi oteffahi commented Feb 28, 2024

These changes remove reading from stdin for all examples, and align their behaviors and outputs across projects.

This PR is part of an effort across currently active Zenoh projects. To maintain examples' implementations as close to each other as possible, any changes identified in other projects will be replicated in this PR. As such, please do not merge these changes until all PRs are ready for merging.

Related PRs:

@eclipse-zenoh-bot
Copy link
Contributor

@oteffahi If this pull request contains a bugfix or a new feature, then please consider using Closes #ISSUE-NUMBER syntax to link it to an issue.

1 similar comment
@eclipse-zenoh-bot
Copy link
Contributor

@oteffahi If this pull request contains a bugfix or a new feature, then please consider using Closes #ISSUE-NUMBER syntax to link it to an issue.

println!("Enter 'q' to quit...");
let mut stdin = async_std::io::stdin();
let mut input = [0_u8];
println!("Press CTRL-C to quit...");
loop {
select!(
Copy link
Member

Choose a reason for hiding this comment

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

Select is no longer necessary, just have a while let Ok(sample) = subscriber.recv().await { .. }.

_ => std::thread::yield_now(),
}
println!("Press CTRL-C to quit...");
loop {
Copy link
Member

Choose a reason for hiding this comment

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

A better way than looping is perhaps to just park the thread.

println!("Enter 'q' to quit...");
let mut stdin = async_std::io::stdin();
let mut input = [0_u8];
println!("Press CTRL-C to quit...");
loop {
select!(
Copy link
Member

Choose a reason for hiding this comment

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

Select is no longer necessary, just have a while let Ok(sample) = subscriber.recv().await { .. }.

println!("Enter 'q' to quit...");
let mut stdin = async_std::io::stdin();
let mut input = [0_u8];
println!("Press CTRL-C to quit...");
loop {
select!(
Copy link
Member

Choose a reason for hiding this comment

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

Select is no longer necessary, just have a while let Ok(sample) = subscriber.recv().await { .. }.

println!("Enter 'q' to quit...");
let mut stdin = async_std::io::stdin();
let mut input = [0u8];
println!("Press CTRL-C to quit...");
loop {
select!(
Copy link
Member

Choose a reason for hiding this comment

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

Select is no longer necessary, just have a while let Ok(sample) = subscriber.recv().await { .. }.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one has a subscriber and a queryable, I believe a select is necessary.

println!("Enter 'q' to quit, 'e' to reply an error to next query...");
let mut stdin = async_std::io::stdin();
let mut input = [0_u8];
println!("Press CTRL-C to quit...");
loop {
select!(
Copy link
Member

Choose a reason for hiding this comment

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

Select is no longer necessary, just have a while let Ok(query) = queryable.recv().await { .. }.

@Mallets Mallets merged commit 61838d5 into eclipse-zenoh:main Mar 13, 2024
8 checks passed
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.

3 participants