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

Switch to async synchronization primitives #13

Merged
merged 3 commits into from
Sep 6, 2020

Conversation

dbcfd
Copy link
Contributor

@dbcfd dbcfd commented Jan 25, 2020

PR for #12

@ebkalderon
Copy link

Looks like this is mostly done in master by c7ef48c, but it seems that it was missed in NatsClientInner::on_connect (I'm ignoring the std::sync::Mutex usage in src/nuid.rs because it doesn't look heavily IO-bound). CC @awesomike

I also wonder why std::sync::RwLock was replaced with futures::sync::Mutex instead of tokio::sync::RwLock? 🤔 This library seems to already be heavily invested in tokio, with heavy structural reliance on tokio::spawn and tokio::io::{AsyncRead, AsyncWrite}, so why not go all-in? It's not a huge deal, though. The most important thing is avoiding stalling the executor with blocking calls; the choice between an async-aware Mutex or RwLock is arguably less important.

@mnetship mnetship merged commit ddb481c into mnetship:master Sep 6, 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.

3 participants