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

Replace async-std with ZRuntime and tokio #937

Merged
merged 2 commits into from
Mar 5, 2025
Merged

Replace async-std with ZRuntime and tokio #937

merged 2 commits into from
Mar 5, 2025

Conversation

Mallets
Copy link
Member

@Mallets Mallets commented Mar 4, 2025

Zenoh moved to tokio already for a quite some time. async-std dependency was still in use in the z_scout implementation. This PR removes async-std dependencies and uses ZRuntime and tokio instead.

@Mallets Mallets added the internal Changes not included in the changelog label Mar 4, 2025
src/scouting.rs Outdated
@@ -209,7 +209,8 @@ pub extern "C" fn z_scout(
})
.await
.unwrap();
async_std::task::sleep(std::time::Duration::from_millis(timeout)).await;

tokio::time::sleep(std::time::Duration::from_millis(timeout)).await;
std::mem::drop(scout);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need to explicitly drop scout here ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think so. Even though it's not meant to be in scope of this PR, I can remove it as part of it if you prefer.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I think it is better to remove unneeded code.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, and I've also improve error handling by removing a dangerous unwrap.

@Mallets Mallets merged commit 2479fec into main Mar 5, 2025
37 checks passed
@Mallets Mallets deleted the remove/async-std branch March 5, 2025 09:50
Mallets added a commit that referenced this pull request Mar 5, 2025
* Fix clippy warnings

* run apt-get update for Cross compile on ubuntu-latest (#938)

* build: Sync  with eclipse-zenoh/zenoh@f421407 from 2025-03-03 (#934)

Co-authored-by: eclipse-zenoh-bot <[email protected]>

* cargo fmt

* Replace async-std with ZRuntime and tokio (#937)

* Replace async-std with ZRuntime and tokio

* Improve error handling in z_scout

* Fix clippy warnings

* cargo fmt

---------

Co-authored-by: DenisBiryukov91 <[email protected]>
Co-authored-by: eclipse-zenoh-bot <[email protected]>
Co-authored-by: eclipse-zenoh-bot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Changes not included in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants